mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-13 10:43:43 +03:00
fix(logs): preserve standalone detail token labels
This commit is contained in:
@@ -519,16 +519,12 @@ export default function RequestLoggerDetail({
|
||||
<span className="px-2 py-0.5 rounded bg-primary/20 text-primary text-xs font-bold">
|
||||
Total In: {formatTokenValue(tokenStats.totalIn)}
|
||||
</span>
|
||||
{tokenStats.cacheRead != null && tokenStats.cacheRead > 0 && (
|
||||
<span className="px-2 py-0.5 rounded bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs font-bold">
|
||||
Cache Read: {formatTokenValue(tokenStats.cacheRead)}
|
||||
</span>
|
||||
)}
|
||||
{tokenStats.cacheWrite != null && tokenStats.cacheWrite > 0 && (
|
||||
<span className="px-2 py-0.5 rounded bg-amber-500/20 text-amber-700 dark:text-amber-400 text-xs font-bold">
|
||||
Cache Write: {formatTokenValue(tokenStats.cacheWrite)}
|
||||
</span>
|
||||
)}
|
||||
<span className="px-2 py-0.5 rounded bg-sky-500/20 text-sky-700 dark:text-sky-400 text-xs font-bold">
|
||||
Cache Read: {formatTokenValue(tokenStats.cacheRead)}
|
||||
</span>
|
||||
<span className="px-2 py-0.5 rounded bg-amber-500/20 text-amber-700 dark:text-amber-400 text-xs font-bold">
|
||||
Cache Write: {formatTokenValue(tokenStats.cacheWrite)}
|
||||
</span>
|
||||
{tokenStats.compressed != null &&
|
||||
tokenStats.compressed > 0 &&
|
||||
(() => {
|
||||
|
||||
@@ -116,9 +116,8 @@ test("request log detail splits token badges into input and output groups", () =
|
||||
|
||||
assert.match(
|
||||
html,
|
||||
/data-testid="token-group-input"[\s\S]*Total In: 21[\s\S]*818[\s\S]*Cache Read: 21[\s\S]*632/
|
||||
/data-testid="token-group-input"[\s\S]*Total In: 21[\s\S]*818[\s\S]*Cache Read: 21[\s\S]*632[\s\S]*Cache Write: N\/A/
|
||||
);
|
||||
assert.equal(html.includes("Cache Write:"), false);
|
||||
assert.match(html, /data-testid="token-group-output"[\s\S]*Total Out: 42[\s\S]*Reasoning: N\/A/);
|
||||
});
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ describe("request log cache token metrics (#9620)", () => {
|
||||
expect(outputGroup?.textContent).toContain("Reasoning: 50");
|
||||
});
|
||||
|
||||
it("omits cache metrics when historical logs contain zero or null values", async () => {
|
||||
it("handles historical null and zero cache values without inventing usage", async () => {
|
||||
const emptyCacheLog = {
|
||||
...populatedLog,
|
||||
id: "log-no-cache",
|
||||
@@ -151,8 +151,8 @@ describe("request log cache token metrics (#9620)", () => {
|
||||
);
|
||||
|
||||
const inputGroup = container.querySelector('[data-testid="token-group-input"]');
|
||||
expect(inputGroup?.textContent).not.toContain("Cache Read");
|
||||
expect(inputGroup?.textContent).not.toContain("Cache Write");
|
||||
expect(inputGroup?.textContent).toContain("Cache Read: N/A");
|
||||
expect(inputGroup?.textContent).toContain("Cache Write: 0");
|
||||
expect(inputGroup?.textContent).toContain("Total In: 1,000");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user