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 src/cli/ui/cards/LiveCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Box paddingLeft={2} flexDirection="row" gap={1}>
Expand All @@ -40,7 +41,7 @@ export function LiveCard({ card }: { card: LiveCardData }): React.ReactElement {
</Text>
)}
<Text color={FG.body}>{card.text}</Text>
{card.meta !== undefined ? <Text color={FG.faint}>{`· ${card.meta}`}</Text> : null}
{card.meta !== undefined ? <Text color={metaColor}>{`· ${card.meta}`}</Text> : null}
</Box>
);
}
2 changes: 1 addition & 1 deletion src/i18n/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions tests/loop-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down