mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
refactor(panel): complete shared single-source rules, isolate per-module bundle scopes, and purify scoped selector
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
normalizeModelDisplayMode,
|
||||
normalizeOrchestratorIdDisplayMode,
|
||||
} from '../core/formatters.js';
|
||||
import { scaleBucketsExact } from '../../shared/telemetry-display-rules.mjs';
|
||||
import { i18nStore, isEnglishLocale, t } from '../i18n/index.js';
|
||||
import { createSvgIcon } from '../icons/SvgIcon.js';
|
||||
import { fetchTelemetry, telemetryStore } from '../store/telemetryStore.js';
|
||||
@@ -572,22 +573,14 @@ export const ConsumptionView = defineComponent({
|
||||
let cachePct = 0;
|
||||
let outPct = 0;
|
||||
if (totalTokens > 0) {
|
||||
const rawTenths = [
|
||||
(inputTokens / totalTokens) * 1000,
|
||||
(cacheTokens / totalTokens) * 1000,
|
||||
(outputTokens / totalTokens) * 1000,
|
||||
];
|
||||
const floored = rawTenths.map((v) => Math.max(0, Math.floor(v)));
|
||||
const rem = Math.max(0, 1000 - (floored[0] + floored[1] + floored[2]));
|
||||
const order = [0, 1, 2].sort(
|
||||
(a, b) => rawTenths[b] - floored[b] - (rawTenths[a] - floored[a])
|
||||
const scaled = scaleBucketsExact(
|
||||
{ in: inputTokens, cache: cacheTokens, out: outputTokens },
|
||||
['in', 'cache', 'out'],
|
||||
1000
|
||||
);
|
||||
for (let k = 0; k < rem && k < 3; k++) {
|
||||
floored[order[k]] += 1;
|
||||
}
|
||||
inPct = +(floored[0] / 10).toFixed(1);
|
||||
cachePct = +(floored[1] / 10).toFixed(1);
|
||||
outPct = +(floored[2] / 10).toFixed(1);
|
||||
inPct = +(scaled.in / 10).toFixed(1);
|
||||
cachePct = +(scaled.cache / 10).toFixed(1);
|
||||
outPct = +(scaled.out / 10).toFixed(1);
|
||||
}
|
||||
|
||||
patchText(inputSharePct, `${inPct}%`);
|
||||
|
||||
@@ -11,7 +11,6 @@ import { telemetryStore } from '../store/telemetryStore.js';
|
||||
import { getVisibleMonitorView, uiStore } from '../store/uiStore.js';
|
||||
import { CustomScrollbar } from '../components/ui/CustomScrollbar.js';
|
||||
import { SegmentedControl } from '../components/ui/SegmentedControl.js';
|
||||
import { SettingsAccountTab } from './settings/SettingsAccountTab.js';
|
||||
import { SettingsGeneralTab } from './settings/SettingsGeneralTab.js';
|
||||
import { SettingsOtherTab } from './settings/SettingsOtherTab.js';
|
||||
import { SettingsStructureTab } from './settings/SettingsStructureTab.js';
|
||||
@@ -52,7 +51,7 @@ export const SettingsView = defineComponent({
|
||||
|
||||
const generalTab = SettingsGeneralTab({ onLayoutChange: refreshScroll });
|
||||
const structureTab = SettingsStructureTab({ onLayoutChange: refreshScroll });
|
||||
const accountTab = SHOW_ACCOUNT_TAB ? SettingsAccountTab({ onLayoutChange: refreshScroll }) : null;
|
||||
const accountTab = null; // SettingsAccountTab kept in src/views/settings/ for future opt-in
|
||||
const otherTab = SettingsOtherTab({ onLayoutChange: refreshScroll });
|
||||
|
||||
let showingAccount = false;
|
||||
|
||||
Reference in New Issue
Block a user