rename GIFs to English, clean up unused files

This commit is contained in:
2026-06-22 09:42:56 +08:00
parent feee5db446
commit 216b7ce02e
9 changed files with 21 additions and 20 deletions
@@ -100,6 +100,20 @@ function T(key) {
}
var PRIORITY = ['error','working','typing','thinking','prompt','done','idle'];
// Status icons
var STATUS_ICONS = {};
(function loadIcons() {
var icons = {thinking:'thinking.gif',working:'working.gif',typing:'typing.gif',done:'done.gif',error:'error.gif'};
Object.keys(icons).forEach(function(k) {
try {
var file = icons[k];
var ext = file.split('.').pop().toLowerCase();
var mime = ext === 'png' ? 'image/png' : ext === 'gif' ? 'image/gif' : 'image/svg+xml';
STATUS_ICONS[k] = 'data:' + mime + ';base64,' + fs.readFileSync(path.join(__dirname, '..', 'static', 'img', file)).toString('base64');
} catch(_) {}
});
})();
var states = {}; // per-context state: { agent, currentState, lastActivity, offsets, timer, logoUri }
function makeSvg(fill, label, blink, breathe) {
@@ -112,18 +126,17 @@ function makeSvg(fill, label, blink, breathe) {
function setDisplay(ctx, state) {
var d = STATUS[state] || STATUS['idle'];
var ss = states[ctx];
if (state === 'idle' && ss && ss.agent) {
// Use relative PNG path for idle
if (state === 'idle' && ss && ss.agent && ss.agent.logoFile) {
plugin.setTitle(ctx, '');
plugin.setImage(ctx, 'static/img/' + ss.agent.logoFile);
} else {
plugin.setTitle(ctx, d.title);
var svg = '<svg width="144" height="144" xmlns="http://www.w3.org/2000/svg"><rect width="144" height="144" rx="20" fill="none"/>';
var anim = '';
if (d.blink) anim = '<animate attributeName="opacity" values="1;0.2;1" dur="0.8s" repeatCount="indefinite"/>';
else if (d.breathe) anim = '<animate attributeName="opacity" values="1;0.4;1" dur="2s" repeatCount="indefinite"/>';
svg += '<circle cx="72" cy="58" r="32" fill="' + d.fill + '">' + anim + '</circle></svg>';
plugin.setImage(ctx, 'data:image/svg+xml;charset=utf-8,' + svg);
var icon = STATUS_ICONS[state];
if (icon) {
plugin.setImage(ctx, icon);
} else {
plugin.setImage(ctx, '');
}
}
}