mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-26 17:09:28 +08:00
feat(panel): upgrade topbar quota ring indicators, unify structure previews, and polish quota panel
This commit is contained in:
@@ -186,10 +186,12 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
isSubagent: false,
|
||||
agentBadge: '主',
|
||||
agentLabel: t('fmt.mainAgent'),
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
modelKey: 'MODEL_PLACEHOLDER_M667',
|
||||
modelLabel: 'Gemini Pro Orchestrator (Carbon)',
|
||||
modelShort: 'orchestrator-carbon',
|
||||
rawModel: 'MODEL_PLACEHOLDER_M667',
|
||||
modelUpstream: 'gemini-pro-orchestrator',
|
||||
upstreamModel: 'gemini-pro-orchestrator',
|
||||
tokPerSec: 17.8,
|
||||
ttftSec: 19.4,
|
||||
totalDurationSec: 31.2,
|
||||
@@ -243,18 +245,19 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
outputTokens: 22100,
|
||||
totalTokens: 1434500,
|
||||
latestModelLabel: 'Gemini 4 Carbon (High)',
|
||||
latestModelShort: 'gemini-4-carbon',
|
||||
latestModelShort: 'carbon-4-high',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M37',
|
||||
latestUpstreamModel: 'gemini-4-carbon-high',
|
||||
activeModelLabel: 'Gemini 4 Carbon (High)',
|
||||
activeModelShort: 'gemini-4-carbon',
|
||||
activeModelShort: 'carbon-4-high',
|
||||
activeModelUpstream: 'gemini-4-carbon-high',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M37',
|
||||
modelShort: 'gemini-4-carbon',
|
||||
modelShort: 'carbon-4-high',
|
||||
modelLabel: 'Gemini 4 Carbon (High)',
|
||||
modelUpstream: 'gemini-4-carbon-high',
|
||||
upstreamModel: 'gemini-4-carbon-high',
|
||||
calls: 16,
|
||||
inputTokens: 152400,
|
||||
@@ -274,6 +277,8 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
agentId: 'sub-1',
|
||||
cascadeId: 'mock-sub-1',
|
||||
isMain: false,
|
||||
agentKind: 'subagent',
|
||||
agentOrdinal: 1,
|
||||
index: 1,
|
||||
badgeText: '子1',
|
||||
shortLabel: `${t('fmt.subAgent')} #1`,
|
||||
@@ -297,18 +302,19 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
outputTokens: 6300,
|
||||
totalTokens: 320300,
|
||||
latestModelLabel: 'Gemini 3.8 Flash',
|
||||
latestModelShort: 'gemini-3.8-flash',
|
||||
latestModelShort: 'flash-3.8',
|
||||
latestRawModel: 'MODEL_PLACEHOLDER_M42',
|
||||
latestUpstreamModel: 'gemini-3.8-flash-n',
|
||||
activeModelLabel: 'Gemini 3.8 Flash',
|
||||
activeModelShort: 'gemini-3.8-flash',
|
||||
activeModelShort: 'flash-3.8',
|
||||
activeModelUpstream: 'gemini-3.8-flash-n',
|
||||
sessionUnpricedCalls: 0,
|
||||
modelBreakdown: [
|
||||
{
|
||||
modelKey: 'MODEL_PLACEHOLDER_M42',
|
||||
modelShort: 'gemini-3.8-flash',
|
||||
modelShort: 'flash-3.8',
|
||||
modelLabel: 'Gemini 3.8 Flash',
|
||||
modelUpstream: 'gemini-3.8-flash-n',
|
||||
upstreamModel: 'gemini-3.8-flash-n',
|
||||
calls: 8,
|
||||
inputTokens: 34000,
|
||||
@@ -331,9 +337,9 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
agentKind: 'all',
|
||||
agentOrdinal: 0,
|
||||
badgeText: t('header.scopeAllShort'),
|
||||
activeAgentId: 'main',
|
||||
activeAgentKind: 'main',
|
||||
activeAgentOrdinal: 0,
|
||||
activeAgentId: 'sub-1',
|
||||
activeAgentKind: 'subagent',
|
||||
activeAgentOrdinal: 1,
|
||||
stepCount: 24,
|
||||
speedSampleCount: 23,
|
||||
speedSummary: { sampleCount: 23, excludedCount: 1 },
|
||||
@@ -347,7 +353,7 @@ export function buildStructurePreviewTelemetry(baseSettings = {}, draftOverrides
|
||||
cacheReadTokens: 1540000,
|
||||
outputTokens: 28400,
|
||||
totalTokens: 1754800,
|
||||
activeAgentBadge: t('fmt.mainBadge'),
|
||||
activeAgentBadge: '子1',
|
||||
modelBreakdown: [...mainAgent.modelBreakdown, ...subAgent1.modelBreakdown],
|
||||
recentSteps: mockSteps,
|
||||
};
|
||||
|
||||
@@ -310,6 +310,7 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
|
||||
const isNone = initialMetric === 'none';
|
||||
const isCtx = initialMetric === 'context';
|
||||
const prefixSpan = h('span', { className: 'wm-slot-prefix' });
|
||||
const textSpan = h('span', {
|
||||
className: isCtx ? 'wm-slot-text wm-ctx-pct' : 'wm-slot-text',
|
||||
text: isNone
|
||||
@@ -320,7 +321,7 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
? '-- t/s'
|
||||
: initialMetric === 'ttft'
|
||||
? '--s'
|
||||
: t('capsule.quotaUnknown'),
|
||||
: '--%',
|
||||
});
|
||||
const el = h(
|
||||
'span',
|
||||
@@ -346,8 +347,10 @@ export function createCapsuleSlotNode(slotIndex, initialMetric) {
|
||||
el,
|
||||
ringSvg,
|
||||
ringFill,
|
||||
prefixSpan,
|
||||
textSpan,
|
||||
ringMounted: isCtx,
|
||||
prefixMounted: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -374,13 +377,25 @@ export function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCt
|
||||
patchAttr(slot.el, 'data-vis-rank', String(visRank));
|
||||
|
||||
if (pres.showRing && !slot.ringMounted) {
|
||||
slot.el.insertBefore(slot.ringSvg, slot.textSpan);
|
||||
slot.el.insertBefore(slot.ringSvg, slot.el.firstChild || slot.textSpan);
|
||||
slot.ringMounted = true;
|
||||
} else if (!pres.showRing && slot.ringMounted) {
|
||||
slot.ringSvg.remove();
|
||||
slot.ringMounted = false;
|
||||
}
|
||||
|
||||
const prefixText = String(pres.prefix || '');
|
||||
if (prefixText) {
|
||||
patchText(slot.prefixSpan, prefixText);
|
||||
if (!slot.prefixMounted) {
|
||||
slot.el.insertBefore(slot.prefixSpan, slot.textSpan);
|
||||
slot.prefixMounted = true;
|
||||
}
|
||||
} else if (slot.prefixMounted) {
|
||||
slot.prefixSpan.remove();
|
||||
slot.prefixMounted = false;
|
||||
}
|
||||
|
||||
const toneCls =
|
||||
pres.toneClass || (pres.danger ? 'tone-danger' : pres.warn ? 'tone-warn' : '');
|
||||
const fullSegClass = `${pres.segClass}${pres.running ? ' state-running' : ''}${toneCls ? ` ${toneCls}` : ''}`;
|
||||
@@ -391,7 +406,12 @@ export function syncCapsuleSlotNodes(capsuleSlots, capsuleSeps, slotKeys, slotCt
|
||||
|
||||
if (pres.showRing) {
|
||||
slot.ringFill.setAttribute('stroke-dashoffset', String(pres.dashOffset));
|
||||
patchClasses(slot.ringFill, { 'tone-warn': pres.warn, 'tone-danger': pres.danger });
|
||||
patchClasses(slot.ringFill, {
|
||||
'is-quota': pres.ringKind === 'quota',
|
||||
'is-empty': pres.ringEmpty === true,
|
||||
'tone-warn': pres.warn,
|
||||
'tone-danger': pres.danger,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export function createPoolQuotaRow() {
|
||||
h('div', { className: 'progress-track' }, [fillWk]),
|
||||
]);
|
||||
|
||||
const el = h('div', { style: 'display: flex; flex-direction: column; gap: 8px;' }, [
|
||||
const el = h('div', { className: 'quota-pool-row' }, [
|
||||
row5h,
|
||||
rowWk,
|
||||
]);
|
||||
@@ -138,13 +138,7 @@ export function formatQuotaSummaryFooter(quotas, account) {
|
||||
*/
|
||||
export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
||||
const { poolData, poolLabel, fallbackWeekly, isActivePool, isPending } = item;
|
||||
patchAttr(
|
||||
rowEl,
|
||||
'style',
|
||||
idx === 0
|
||||
? 'display: flex; flex-direction: column; gap: 8px;'
|
||||
: 'display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-hairline);'
|
||||
);
|
||||
patchClasses(rowEl, { 'quota-pool-row': true, 'has-divider': idx > 0 });
|
||||
|
||||
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
||||
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
||||
@@ -289,13 +283,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
const initFoot = formatQuotaSummaryFooter(null, null);
|
||||
const wkFootLeft = h('span', { className: 'text-muted', text: initFoot.leftText });
|
||||
const wkFootRight = h('span', {
|
||||
className: 'text-muted',
|
||||
text: compactHover ? initFoot.rightText : '',
|
||||
});
|
||||
|
||||
const quotaPanel = h('section', { className: 'panel' }, [
|
||||
h('div', { className: 'panel-header' }, [
|
||||
h('span', { className: 'panel-title' }, [
|
||||
@@ -305,13 +292,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
tierBadge,
|
||||
]),
|
||||
poolsListEl,
|
||||
h(
|
||||
'div',
|
||||
compactHover
|
||||
? { className: 'panel-header wm-hover-quota-foot' }
|
||||
: { className: 'panel-header', style: 'font-size: var(--fs-md); padding-top: 2px;' },
|
||||
[wkFootLeft, wkFootRight]
|
||||
),
|
||||
]);
|
||||
|
||||
function update({ data, minuteTick } = {}) {
|
||||
@@ -324,9 +304,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
const pendingFoot = formatQuotaSummaryFooter(null, null);
|
||||
patchText(wkFootLeft, pendingFoot.leftText);
|
||||
patchText(wkFootRight, pendingFoot.rightText);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -343,12 +320,6 @@ export const QuotaPoolsWidget = defineComponent({
|
||||
createRow: createPoolQuotaRow,
|
||||
updateRow: syncPoolQuotaRow,
|
||||
});
|
||||
|
||||
const footSummary = formatQuotaSummaryFooter(quotas, data.account);
|
||||
patchText(wkFootLeft, footSummary.leftText);
|
||||
patchText(wkFootRight, footSummary.rightText);
|
||||
patchAttr(wkFootLeft, 'title', footSummary.tooltip);
|
||||
patchAttr(wkFootRight, 'title', footSummary.tooltip);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user