mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-14 08:19:51 +02:00
link the usage with the session to display together
This commit is contained in:
@@ -459,7 +459,7 @@ export default function AiSessionLogsPage() {
|
||||
const renderExpandedRow = (row: any) => {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4 text-xs">
|
||||
<div className="grid grid-cols-2 sm:grid-cols-4 gap-4 text-xs">
|
||||
<div>
|
||||
<strong>{t("aiSessionId")}</strong>
|
||||
<p className="text-muted-foreground mt-1 break-all">
|
||||
@@ -472,6 +472,26 @@ export default function AiSessionLogsPage() {
|
||||
{row.statusCode ?? "N/A"}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<strong>{t("tokens")}</strong>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{row.usage
|
||||
? `${row.usage.totalTokens.toLocaleString()}${
|
||||
row.usage.estimated
|
||||
? ` (${t("estimated")})`
|
||||
: ""
|
||||
}`
|
||||
: "N/A"}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<strong>{t("cost")}</strong>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{row.usage && row.usage.costUsd != null
|
||||
? `$${row.usage.costUsd.toFixed(4)}`
|
||||
: "N/A"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<AiSessionChatView
|
||||
normalizedRequest={row.normalizedRequest}
|
||||
@@ -572,7 +592,17 @@ function generateSampleAiSessionLogs(): QueryAiSessionLogResponse["log"] {
|
||||
statusCode: 200,
|
||||
createdAt: Math.floor(
|
||||
sevenDaysAgoMs + Math.random() * (now - sevenDaysAgoMs)
|
||||
)
|
||||
),
|
||||
usage: {
|
||||
promptTokens: 500,
|
||||
cacheReadTokens: 0,
|
||||
cacheWriteTokens: 0,
|
||||
completionTokens: 150,
|
||||
reasoningTokens: 0,
|
||||
totalTokens: 650,
|
||||
costUsd: 0.0123,
|
||||
estimated: false
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user