Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/ChatInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ function QueuedMessageRow({ kind, text }: { kind: "steer" | "follow-up"; text: s
}

function ModelNoticeBanner({ tone, title, body, onClose }: { tone: "error" | "warning"; title: string; body: string; onClose?: () => void }) {
const { t } = useI18n();
const color = tone === "error" ? "239,68,68" : "234,179,8";
return (
<div
Expand Down Expand Up @@ -609,7 +610,7 @@ function ModelNoticeBanner({ tone, title, body, onClose }: { tone: "error" | "wa
<button
type="button"
onClick={onClose}
aria-label="Dismiss"
aria-label={t("sidebar.dismiss")}
style={{
flexShrink: 0,
background: "none",
Expand Down
17 changes: 9 additions & 8 deletions components/MessageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ function AssistantMessageView({
{(message.usage || turnDurationMs !== undefined) && !isStreaming && (
<div style={{ fontSize: 11, color: "var(--text-dim)" }}>
{[
message.usage ? formatUsage(message.usage) : null,
message.usage ? formatUsage(message.usage, t) : null,
turnDurationMs !== undefined ? t("chat.turnDuration", { time: formatTurnDuration(turnDurationMs) }) : null,
].filter(Boolean).join(" \u00b7 ")}
</div>
Expand Down Expand Up @@ -2225,17 +2225,18 @@ function formatUsage(usage: {
cacheRead: number;
cacheWrite: number;
cost: { total: number };
}): string {
}, t: (key: string, params?: Record<string, string | number>) => string): string {
const parts = [];
if (usage.input) parts.push(`${usage.input.toLocaleString()} in`);
if (usage.output) parts.push(`${usage.output.toLocaleString()} out`);
if (usage.cacheRead) parts.push(`${usage.cacheRead.toLocaleString()} cache R`);
if (usage.cacheWrite) parts.push(`${usage.cacheWrite.toLocaleString()} cache W`);
if (usage.input) parts.push(t("chat.usageInput", { count: usage.input.toLocaleString() }));
if (usage.output) parts.push(t("chat.usageOutput", { count: usage.output.toLocaleString() }));
if (usage.cacheRead) parts.push(t("chat.usageCacheRead", { count: usage.cacheRead.toLocaleString() }));
if (usage.cacheWrite) parts.push(t("chat.usageCacheWrite", { count: usage.cacheWrite.toLocaleString() }));
if (usage.cost?.total) parts.push(`$${usage.cost.total.toFixed(4)}`);
return parts.join(" · ");
}

function BashExecutionView({ message, sessionId }: { message: BashExecutionMessage; sessionId?: string }) {
const { t } = useI18n();
const [fullOutput, setFullOutput] = useState<string | null>(null);
const [loadingFull, setLoadingFull] = useState(false);
const [fullError, setFullError] = useState<string | null>(null);
Expand Down Expand Up @@ -2299,14 +2300,14 @@ function BashExecutionView({ message, sessionId }: { message: BashExecutionMessa
disabled={loadingFull}
style={{ background: "none", border: "none", color: "var(--accent)", cursor: loadingFull ? "default" : "pointer", fontSize: 11, padding: 0, textDecoration: "underline" }}
>
{loadingFull ? "loading…" : "view full output"}
{loadingFull ? t("chat.loadingFullOutput") : t("chat.viewFullOutput")}
</button>
)}
<a
href={`${fullOutputUrl}&download=1`}
style={{ marginLeft: showFullButton ? 10 : 0, color: "var(--accent)", fontSize: 11, textDecoration: "underline" }}
>
download full output
{t("chat.downloadFullOutput")}
</a>
{fullError && <span style={{ marginLeft: 6, color: "var(--text-dim)", fontSize: 11 }}>({fullError})</span>}
</div>
Expand Down
7 changes: 7 additions & 0 deletions lib/i18n/messages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ export const enLocale: LocalePlugin = {
"chat.toolCall": "tool call",
"chat.toolCalls": "tool calls",
"chat.turnDuration": "took {time}",
"chat.usageInput": "{count} in",
"chat.usageOutput": "{count} out",
"chat.usageCacheRead": "{count} cache R",
"chat.usageCacheWrite": "{count} cache W",
"chat.viewFullOutput": "view full output",
"chat.loadingFullOutput": "loading…",
"chat.downloadFullOutput": "download full output",
"chat.collapseProcess": "Collapse process details",
"chat.expandProcess": "Expand process details",
"transcriptNotice.costSuffix": " (~{cost})",
Expand Down
7 changes: 7 additions & 0 deletions lib/i18n/messages/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ export const zhCNLocale: LocalePlugin = {
"chat.toolCall": "次工具调用",
"chat.toolCalls": "次工具调用",
"chat.turnDuration": "耗时 {time}",
"chat.usageInput": "输入 {count}",
"chat.usageOutput": "输出 {count}",
"chat.usageCacheRead": "缓存读取 {count}",
"chat.usageCacheWrite": "缓存写入 {count}",
"chat.viewFullOutput": "查看完整输出",
"chat.loadingFullOutput": "加载中…",
"chat.downloadFullOutput": "下载完整输出",
"chat.collapseProcess": "收起处理详情",
"chat.expandProcess": "展开处理详情",
"transcriptNotice.costSuffix": "(约 {cost})",
Expand Down
7 changes: 7 additions & 0 deletions lib/i18n/messages/zh-TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ export const zhTWLocale: LocalePlugin = {
"chat.toolCall": "次工具呼叫",
"chat.toolCalls": "次工具呼叫",
"chat.turnDuration": "耗時 {time}",
"chat.usageInput": "輸入 {count}",
"chat.usageOutput": "輸出 {count}",
"chat.usageCacheRead": "快取讀取 {count}",
"chat.usageCacheWrite": "快取寫入 {count}",
"chat.viewFullOutput": "檢視完整輸出",
"chat.loadingFullOutput": "載入中…",
"chat.downloadFullOutput": "下載完整輸出",
"chat.collapseProcess": "收起處理詳細資料",
"chat.expandProcess": "展開處理詳細資料",
"transcriptNotice.costSuffix": "(約 {cost})",
Expand Down
Loading