chatccc 0.2.174 → 0.2.175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/feishu-api.ts +30 -29
package/package.json
CHANGED
package/src/feishu-api.ts
CHANGED
|
@@ -315,7 +315,7 @@ const AVATAR_BADGES: Record<string, string> = {
|
|
|
315
315
|
const AVATAR_SIZE = 256;
|
|
316
316
|
const AVATAR_BADGE_SIZE = 92;
|
|
317
317
|
const AVATAR_BADGE_MARGIN = 10;
|
|
318
|
-
const CODEX_AVATAR_USAGE_STYLE_VERSION = "usage-ring-gray-consumed-
|
|
318
|
+
const CODEX_AVATAR_USAGE_STYLE_VERSION = "usage-ring-gray-consumed-v5";
|
|
319
319
|
|
|
320
320
|
export interface CodexUsageBalance {
|
|
321
321
|
usedPercent: number;
|
|
@@ -467,24 +467,25 @@ function codexUsagePalette(remainingPercent: number): { start: string; end: stri
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
function buildCodexUsageBatterySvg(remainingPercent: number): Buffer {
|
|
470
|
-
const remaining = clampPercent(remainingPercent);
|
|
471
|
-
const label =
|
|
472
|
-
const palette = codexUsagePalette(remaining);
|
|
473
|
-
|
|
474
|
-
const bodyX = 28;
|
|
475
|
-
const bodyY = 38;
|
|
476
|
-
const bodyW =
|
|
477
|
-
const bodyH =
|
|
478
|
-
const capW =
|
|
479
|
-
const capH =
|
|
480
|
-
const capX = bodyX + bodyW;
|
|
481
|
-
const capY = bodyY + Math.round((bodyH - capH) / 2);
|
|
482
|
-
const pad =
|
|
483
|
-
const fillMaxW = bodyW - pad * 2;
|
|
484
|
-
const fillWidth = Math.round((fillMaxW * remaining) / 100);
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
470
|
+
const remaining = clampPercent(remainingPercent);
|
|
471
|
+
const label = String(remaining);
|
|
472
|
+
const palette = codexUsagePalette(remaining);
|
|
473
|
+
|
|
474
|
+
const bodyX = 28;
|
|
475
|
+
const bodyY = 38;
|
|
476
|
+
const bodyW = 109;
|
|
477
|
+
const bodyH = 56;
|
|
478
|
+
const capW = 12;
|
|
479
|
+
const capH = 22;
|
|
480
|
+
const capX = bodyX + bodyW;
|
|
481
|
+
const capY = bodyY + Math.round((bodyH - capH) / 2);
|
|
482
|
+
const pad = 6;
|
|
483
|
+
const fillMaxW = bodyW - pad * 2;
|
|
484
|
+
const fillWidth = Math.round((fillMaxW * remaining) / 100);
|
|
485
|
+
const labelFontSize = label.length >= 3 ? 49 : 51;
|
|
486
|
+
|
|
487
|
+
return Buffer.from(`
|
|
488
|
+
<svg width="256" height="256" xmlns="http://www.w3.org/2000/svg">
|
|
488
489
|
<defs>
|
|
489
490
|
<filter id="shadow" x="-35%" y="-35%" width="170%" height="170%">
|
|
490
491
|
<feDropShadow dx="0" dy="4" stdDeviation="4" flood-color="#4a2712" flood-opacity="0.30"/>
|
|
@@ -500,16 +501,16 @@ function buildCodexUsageBatterySvg(remainingPercent: number): Buffer {
|
|
|
500
501
|
<clipPath id="batteryInnerClip">
|
|
501
502
|
<rect x="${bodyX + pad}" y="${bodyY + pad}" width="${fillMaxW}" height="${bodyH - pad * 2}" rx="10"/>
|
|
502
503
|
</clipPath>
|
|
503
|
-
</defs>
|
|
504
|
-
<g filter="url(#shadow)">
|
|
505
|
-
<rect x="${bodyX}" y="${bodyY}" width="${bodyW}" height="${bodyH}" rx="
|
|
506
|
-
<rect x="${bodyX + pad}" y="${bodyY + pad}" width="${fillMaxW}" height="${bodyH - pad * 2}" rx="
|
|
507
|
-
<rect x="${bodyX + pad}" y="${bodyY + pad}" width="${fillWidth}" height="${bodyH - pad * 2}" fill="url(#fill)" clip-path="url(#batteryInnerClip)"/>
|
|
508
|
-
<rect x="${bodyX + pad +
|
|
509
|
-
<rect x="${capX}" y="${capY}" width="${capW}" height="${capH}" rx="
|
|
510
|
-
<rect x="${bodyX}" y="${bodyY}" width="${bodyW}" height="${bodyH}" rx="
|
|
511
|
-
<text x="${bodyX + bodyW / 2}" y="${bodyY +
|
|
512
|
-
</g>
|
|
504
|
+
</defs>
|
|
505
|
+
<g filter="url(#shadow)">
|
|
506
|
+
<rect x="${bodyX}" y="${bodyY}" width="${bodyW}" height="${bodyH}" rx="18" fill="#0f172a"/>
|
|
507
|
+
<rect x="${bodyX + pad}" y="${bodyY + pad}" width="${fillMaxW}" height="${bodyH - pad * 2}" rx="12" fill="url(#well)"/>
|
|
508
|
+
<rect x="${bodyX + pad}" y="${bodyY + pad}" width="${fillWidth}" height="${bodyH - pad * 2}" fill="url(#fill)" clip-path="url(#batteryInnerClip)"/>
|
|
509
|
+
<rect x="${bodyX + pad + 4}" y="${bodyY + pad + 5}" width="${Math.max(0, fillWidth - 8)}" height="8" rx="4" fill="${palette.glow}" fill-opacity="0.42" clip-path="url(#batteryInnerClip)"/>
|
|
510
|
+
<rect x="${capX}" y="${capY}" width="${capW}" height="${capH}" rx="6" fill="#0f172a"/>
|
|
511
|
+
<rect x="${bodyX}" y="${bodyY}" width="${bodyW}" height="${bodyH}" rx="18" fill="none" stroke="#f8fafc" stroke-opacity="0.82" stroke-width="3.8"/>
|
|
512
|
+
<text x="${bodyX + bodyW / 2}" y="${bodyY + bodyH / 2 + 3}" text-anchor="middle" dominant-baseline="middle" alignment-baseline="middle" font-family="Arial, Helvetica, sans-serif" font-size="${labelFontSize}" font-weight="700" letter-spacing="0" stroke="#0b1220" stroke-width="2.6" paint-order="stroke" stroke-linejoin="round" fill="#ffffff">${label}</text>
|
|
513
|
+
</g>
|
|
513
514
|
</svg>`);
|
|
514
515
|
}
|
|
515
516
|
|