mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 01:32:22 +03:00
fix(logs): keep detail rendering independent of next-intl
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { useTranslations } from "next-intl";
|
||||
import {
|
||||
PROVIDER_COLORS,
|
||||
getHttpStatusStyle as getStatusStyle,
|
||||
@@ -197,8 +196,6 @@ export default function RequestLoggerDetail({
|
||||
relatedLogs = [],
|
||||
onSelectRelated,
|
||||
}) {
|
||||
const tCache = useTranslations("cache");
|
||||
|
||||
// Close on Escape key
|
||||
useEffect(() => {
|
||||
const handler = (e) => {
|
||||
@@ -524,12 +521,12 @@ export default function RequestLoggerDetail({
|
||||
</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">
|
||||
{tCache("cachedTokensCol")}: {formatTokenValue(tokenStats.cacheRead)}
|
||||
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">
|
||||
{tCache("cacheCreation")}: {formatTokenValue(tokenStats.cacheWrite)}
|
||||
Cache Write: {formatTokenValue(tokenStats.cacheWrite)}
|
||||
</span>
|
||||
)}
|
||||
{tokenStats.compressed != null &&
|
||||
|
||||
@@ -116,8 +116,9 @@ 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[\s\S]*Cache Write: N\/A/
|
||||
/data-testid="token-group-input"[\s\S]*Total In: 21[\s\S]*818[\s\S]*Cache Read: 21[\s\S]*632/
|
||||
);
|
||||
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/);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user