Skip to content

Commit 97855ad

Browse files
committed
fix(inference): preserve legacy and localized tooltips
Keep an explicit legacy offload fallback when detailed runtime metadata is unavailable, and rebuild unofficial overlay layers when the locale changes. 中文:保留旧版及本地化提示卡。在缺少详细运行时元数据时显示明确的旧版卸载状态,并在语言切换后重新构建非正式运行覆盖层。
1 parent d569d4c commit 97855ad

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

packages/app/src/components/inference/ui/ScatterGraph.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,7 @@ const ScatterGraph = React.memo(
22832283
yLabel,
22842284
selectedYAxisMetric,
22852285
chartDefinition,
2286+
locale,
22862287
]);
22872288

22882289
// Layers handle for the decoration effect — lets it re-run individual

packages/app/src/components/inference/utils/tooltip-utils.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,21 @@ describe('generateTooltipContent', () => {
262262
expect(html).not.toContain('Offload Mode');
263263
});
264264

265+
it('keeps a clearly marked binary fallback for legacy agentic rows', () => {
266+
const enabled = generateTooltipContent(
267+
tooltipConfig({ data: pt({ offload_mode: 'on', kv_offloading: undefined }) }),
268+
);
269+
const disabledZh = generateTooltipContent(
270+
tooltipConfig({
271+
locale: 'zh',
272+
data: pt({ offload_mode: 'off', kv_offloading: undefined }),
273+
}),
274+
);
275+
276+
expect(enabled).toContain('<strong>Offload Type:</strong> Enabled (legacy data)');
277+
expect(disabledZh).toContain('<strong>卸载类型:</strong> 已禁用(旧版数据)');
278+
});
279+
265280
it('shows multinode KV transfer and cache-hit metadata for fixed-sequence points', () => {
266281
const html = generateTooltipContent(
267282
tooltipConfig({

packages/app/src/components/inference/utils/tooltipUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ const CACHE_STRINGS = {
103103
cpuHitRate: 'CPU Cache Hit Rate',
104104
theoreticalHitRate: 'Theoretical Cache Hit Rate',
105105
none: 'None',
106+
legacyEnabled: 'Enabled (legacy data)',
107+
legacyDisabled: 'Disabled (legacy data)',
106108
},
107109
zh: {
108110
offloadType: '卸载类型',
@@ -113,6 +115,8 @@ const CACHE_STRINGS = {
113115
cpuHitRate: 'CPU Cache 命中率',
114116
theoreticalHitRate: '理论 Cache 命中率',
115117
none: '无',
118+
legacyEnabled: '已启用(旧版数据)',
119+
legacyDisabled: '已禁用(旧版数据)',
116120
},
117121
} as const;
118122

@@ -149,6 +153,9 @@ const generateCacheMetadataHTML = (d: InferenceData, locale: Locale): string =>
149153
const parts: string[] = [];
150154
if (d.kv_offloading) {
151155
parts.push(tooltipLine(t.offloadType, offloadTypeLabel(d.kv_offloading, locale)));
156+
} else if (d.offload_mode) {
157+
const enabled = d.offload_mode.toLowerCase() === 'on';
158+
parts.push(tooltipLine(t.offloadType, enabled ? t.legacyEnabled : t.legacyDisabled));
152159
}
153160
if (d.kv_offload_backend) {
154161
const backend = cacheImplementationLabel(d.kv_offload_backend);

0 commit comments

Comments
 (0)