diff --git a/src/app/[locale]/dashboard/logs/_components/error-details-dialog.tsx b/src/app/[locale]/dashboard/logs/_components/error-details-dialog.tsx index fe3779b5c..b365abe1c 100644 --- a/src/app/[locale]/dashboard/logs/_components/error-details-dialog.tsx +++ b/src/app/[locale]/dashboard/logs/_components/error-details-dialog.tsx @@ -47,6 +47,7 @@ interface ErrorDetailsDialogProps { // 计费详情 inputTokens?: number | null; outputTokens?: number | null; + cacheCreationInputTokens?: number | null; // 缓存创建总量 cacheCreation5mInputTokens?: number | null; cacheCreation1hInputTokens?: number | null; cacheReadInputTokens?: number | null; @@ -77,6 +78,7 @@ export function ErrorDetailsDialog({ billingModelSource = "original", inputTokens, outputTokens, + cacheCreationInputTokens, cacheCreation5mInputTokens, cacheCreation1hInputTokens, cacheReadInputTokens, @@ -421,25 +423,35 @@ export function ErrorDetailsDialog({ {formatTokenAmount(outputTokens)} tokens - {(cacheCreation5mInputTokens ?? 0) > 0 && ( + {((cacheCreation5mInputTokens ?? 0) > 0 || + ((cacheCreationInputTokens ?? 0) > 0 && cacheTtlApplied !== "1h")) && (
{t("logs.billingDetails.cacheWrite5m")}: - {formatTokenAmount(cacheCreation5mInputTokens)} tokens{" "} - (1.25x) + {formatTokenAmount( + (cacheCreation5mInputTokens ?? 0) > 0 + ? cacheCreation5mInputTokens + : cacheCreationInputTokens + )}{" "} + tokens (1.25x)
)} - {(cacheCreation1hInputTokens ?? 0) > 0 && ( + {((cacheCreation1hInputTokens ?? 0) > 0 || + ((cacheCreationInputTokens ?? 0) > 0 && cacheTtlApplied === "1h")) && (
{t("logs.billingDetails.cacheWrite1h")}: - {formatTokenAmount(cacheCreation1hInputTokens)} tokens{" "} - (2x) + {formatTokenAmount( + (cacheCreation1hInputTokens ?? 0) > 0 + ? cacheCreation1hInputTokens + : cacheCreationInputTokens + )}{" "} + tokens (2x)
)} diff --git a/src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx b/src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx index 2f4c43de5..4177ddfdd 100644 --- a/src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx +++ b/src/app/[locale]/dashboard/logs/_components/usage-logs-table.tsx @@ -252,10 +252,24 @@ export function UsageLogsTable({
{t("logs.columns.cacheWrite")}
- 5m: {formatTokenAmount(log.cacheCreation5mInputTokens)} + 5m:{" "} + {formatTokenAmount( + (log.cacheCreation5mInputTokens ?? 0) > 0 + ? log.cacheCreation5mInputTokens + : log.cacheTtlApplied !== "1h" + ? log.cacheCreationInputTokens + : 0 + )}
- 1h: {formatTokenAmount(log.cacheCreation1hInputTokens)} + 1h:{" "} + {formatTokenAmount( + (log.cacheCreation1hInputTokens ?? 0) > 0 + ? log.cacheCreation1hInputTokens + : log.cacheTtlApplied === "1h" + ? log.cacheCreationInputTokens + : 0 + )}
{t("logs.columns.cacheRead")}
@@ -425,6 +439,7 @@ export function UsageLogsTable({ billingModelSource={billingModelSource} inputTokens={log.inputTokens} outputTokens={log.outputTokens} + cacheCreationInputTokens={log.cacheCreationInputTokens} cacheCreation5mInputTokens={log.cacheCreation5mInputTokens} cacheCreation1hInputTokens={log.cacheCreation1hInputTokens} cacheReadInputTokens={log.cacheReadInputTokens} diff --git a/src/app/[locale]/dashboard/logs/_components/virtualized-logs-table.tsx b/src/app/[locale]/dashboard/logs/_components/virtualized-logs-table.tsx index 952a177bb..bb2829afa 100644 --- a/src/app/[locale]/dashboard/logs/_components/virtualized-logs-table.tsx +++ b/src/app/[locale]/dashboard/logs/_components/virtualized-logs-table.tsx @@ -428,10 +428,24 @@ export function VirtualizedLogsTable({
{t("logs.columns.cacheWrite")}
- 5m: {formatTokenAmount(log.cacheCreation5mInputTokens)} + 5m:{" "} + {formatTokenAmount( + (log.cacheCreation5mInputTokens ?? 0) > 0 + ? log.cacheCreation5mInputTokens + : log.cacheTtlApplied !== "1h" + ? log.cacheCreationInputTokens + : 0 + )}
- 1h: {formatTokenAmount(log.cacheCreation1hInputTokens)} + 1h:{" "} + {formatTokenAmount( + (log.cacheCreation1hInputTokens ?? 0) > 0 + ? log.cacheCreation1hInputTokens + : log.cacheTtlApplied === "1h" + ? log.cacheCreationInputTokens + : 0 + )}
{t("logs.columns.cacheRead")}
{formatTokenAmount(log.cacheReadInputTokens)}
@@ -555,6 +569,7 @@ export function VirtualizedLogsTable({ billingModelSource={billingModelSource} inputTokens={log.inputTokens} outputTokens={log.outputTokens} + cacheCreationInputTokens={log.cacheCreationInputTokens} cacheCreation5mInputTokens={log.cacheCreation5mInputTokens} cacheCreation1hInputTokens={log.cacheCreation1hInputTokens} cacheReadInputTokens={log.cacheReadInputTokens}