diff --git a/src/cli/ui/cards/LiveCard.tsx b/src/cli/ui/cards/LiveCard.tsx index 5aca8cc..3d2441b 100644 --- a/src/cli/ui/cards/LiveCard.tsx +++ b/src/cli/ui/cards/LiveCard.tsx @@ -29,6 +29,7 @@ const VARIANT_GLYPH = { export function LiveCard({ card }: { card: LiveCardData }): React.ReactElement { const color = TONE_TO_COLOR[card.tone]; + const metaColor = card.tone === "err" || card.tone === "warn" ? color : FG.faint; const glyph = VARIANT_GLYPH[card.variant]; return ( @@ -40,7 +41,7 @@ export function LiveCard({ card }: { card: LiveCardData }): React.ReactElement { )} {card.text} - {card.meta !== undefined ? {`· ${card.meta}`} : null} + {card.meta !== undefined ? {`· ${card.meta}`} : null} ); } diff --git a/src/i18n/zh-CN.ts b/src/i18n/zh-CN.ts index 7afc2e3..f1b9aba 100644 --- a/src/i18n/zh-CN.ts +++ b/src/i18n/zh-CN.ts @@ -655,7 +655,7 @@ export const zhCN: TranslationSchema = { auth401: "认证失败(DeepSeek 401):{inner}。你的 API key 被拒绝。运行 `carboncode setup` 或 `export DEEPSEEK_API_KEY=sk-...` 修复。在 https://platform.deepseek.com/api_keys 获取 key。", balance402: - "余额不足(DeepSeek 402):{inner}。在 https://platform.deepseek.com/top_up 充值 — 余额非零时面板顶栏会显示。", + "余额不足(DeepSeek 402)。请在 https://platform.deepseek.com/top_up 充值;充值到账后重新发送。", badparam422: "参数错误(DeepSeek 422):{inner}", badrequest400: "请求错误(DeepSeek 400):{inner}", deepseek5xxHead: diff --git a/tests/loop-error.test.ts b/tests/loop-error.test.ts index f1f9d97..0cc38bf 100644 --- a/tests/loop-error.test.ts +++ b/tests/loop-error.test.ts @@ -142,6 +142,16 @@ describe("formatLoopError — zh-CN runtime switch", () => { expect(out).toContain("Authentication Fails"); expect(out).toContain("carboncode setup"); }); + + it("402 balance error translates when language is zh-CN without repeating the English server text", () => { + setLanguageRuntime("zh-CN"); + const out = formatLoopError( + new Error('DeepSeek 402: {"error":{"message":"Insufficient Balance"}}'), + ); + expect(out).toContain("余额不足"); + expect(out).toContain("top_up"); + expect(out).not.toContain("Insufficient Balance"); + }); }); describe("healLoadedMessages", () => {