Skip to content
Merged
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
4 changes: 2 additions & 2 deletions messages/en/usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@
"important": "Important",
"importantPoints": [
"Create an API key in the cch console and set the CCH_API_KEY environment variable",
"All providers use ${resolvedOrigin}/v1 as baseURL (cch v1 API base URL)",
"When selecting models, use provider_id/model_id (e.g. cchClaude/claude-sonnet-4-5-20250929)"
"cchClaude/openai use ${resolvedOrigin}/v1; cchGemini uses ${resolvedOrigin}/v1beta",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing cchClaude/openai use... could be slightly confusing, as it might be misinterpreted as a single provider named cchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.

Suggested change
"cchClaude/openai use ${resolvedOrigin}/v1; cchGemini uses ${resolvedOrigin}/v1beta",
"cchClaude and openai use ${resolvedOrigin}/v1; cchGemini uses ${resolvedOrigin}/v1beta",

"When selecting models, use provider_id/model_id (e.g. openai/gpt-5.2 or cchClaude/claude-sonnet-4-5-20250929)"
]
},

Expand Down
4 changes: 2 additions & 2 deletions messages/ja/usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@
"important": "重要",
"importantPoints": [
"cch の管理画面で API Key を作成し、環境変数 CCH_API_KEY を設定してください",
"3 つの provider すべてで baseURL は ${resolvedOrigin}/v1(cch の v1 API ベース URL)",
"モデル選択は provider_id/model_id 形式(例:cchClaude/claude-sonnet-4-5-20250929)"
"cchClaude/openai は ${resolvedOrigin}/v1、cchGemini は ${resolvedOrigin}/v1beta を baseURL に使用します",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing cchClaude/openai は... could be slightly confusing, as it might be misinterpreted as a single provider named cchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.

Suggested change
"cchClaude/openai は ${resolvedOrigin}/v1、cchGemini は ${resolvedOrigin}/v1beta を baseURL に使用します",
"cchClaudeopenai は ${resolvedOrigin}/v1、cchGemini は ${resolvedOrigin}/v1beta を baseURL に使用します",

"モデル選択は provider_id/model_id 形式(例:openai/gpt-5.2 または cchClaude/claude-sonnet-4-5-20250929)"
]
},

Expand Down
4 changes: 2 additions & 2 deletions messages/ru/usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@
"important": "Важно",
"importantPoints": [
"Создайте API key в панели cch и задайте переменную окружения CCH_API_KEY",
"Все provider используют ${resolvedOrigin}/v1 как baseURL (базовый URL cch v1 API)",
"При выборе модели используйте provider_id/model_id (например, cchClaude/claude-sonnet-4-5-20250929)"
"cchClaude/openai используют ${resolvedOrigin}/v1; cchGemini использует ${resolvedOrigin}/v1beta",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing cchClaude/openai используют... could be slightly confusing, as it might be misinterpreted as a single provider named cchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.

Suggested change
"cchClaude/openai используют ${resolvedOrigin}/v1; cchGemini использует ${resolvedOrigin}/v1beta",
"cchClaude и openai используют ${resolvedOrigin}/v1; cchGemini использует ${resolvedOrigin}/v1beta",

"При выборе модели используйте provider_id/model_id (например, openai/gpt-5.2 или cchClaude/claude-sonnet-4-5-20250929)"
]
},

Expand Down
4 changes: 2 additions & 2 deletions messages/zh-CN/usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@
"important": "重要说明",
"importantPoints": [
"请先在 cch 后台创建 API Key,并设置环境变量 CCH_API_KEY",
"三个 provider 的 baseURL 都使用 ${resolvedOrigin}/v1(cch v1 API 地址)",
"模型选择时使用 provider_id/model_id 格式(例如 cchClaude/claude-sonnet-4-5-20250929)"
"cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing cchClaude/openai 使用... could be slightly confusing, as it might be misinterpreted as a single provider named cchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.

Suggested change
"cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",
"cchClaudeopenai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",

"模型选择时使用 provider_id/model_id 格式(例如 openai/gpt-5.2 或 cchClaude/claude-sonnet-4-5-20250929)"
]
},

Expand Down
4 changes: 2 additions & 2 deletions messages/zh-TW/usage.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@
"important": "重要說明",
"importantPoints": [
"請先在 cch 後台創建 API Key,並設置環境變量 CCH_API_KEY",
"三個 provider 的 baseURL 都使用 ${resolvedOrigin}/v1(cch v1 API 地址)",
"模型選擇時使用 provider_id/model_id 格式(例如 cchClaude/claude-sonnet-4-5-20250929)"
"cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The phrasing cchClaude/openai 使用... could be slightly confusing, as it might be misinterpreted as a single provider named cchClaude/openai. To improve clarity, consider rephrasing to explicitly state that these are two separate providers.

Suggested change
"cchClaude/openai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",
"cchClaudeopenai 使用 ${resolvedOrigin}/v1,cchGemini 使用 ${resolvedOrigin}/v1beta",

"模型選擇時使用 provider_id/model_id 格式(例如 openai/gpt-5.2 或 cchClaude/claude-sonnet-4-5-20250929)"
]
},

Expand Down
24 changes: 22 additions & 2 deletions src/app/[locale]/usage-doc/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,8 @@ gemini`}
$schema: "https://opencode.ai/config.json",
theme: "opencode",
autoupdate: false,
model: "openai/gpt-5.2",
small_model: "openai/gpt-5.2-small",
Comment on lines +1083 to +1084
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model references use openai/gpt-5.2 and openai/gpt-5.2-small, expecting a provider named openai. However, the GPT provider is named cchGPT at line 1099. This mismatch will cause OpenCode to fail when trying to resolve these models because it won't find a provider with ID openai.

These model references should either:

  1. Be changed to cchGPT/gpt-5.2 and cchGPT/gpt-5.2-small to match the provider name, OR
  2. The provider at line 1099 should be renamed from cchGPT to openai

Based on the i18n examples (which use openai/gpt-5.2) and the test expectations, option 2 (renaming provider to openai) appears to be the intended fix.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/app/[locale]/usage-doc/page.tsx
Line: 1083:1084

Comment:
The model references use `openai/gpt-5.2` and `openai/gpt-5.2-small`, expecting a provider named `openai`. However, the GPT provider is named `cchGPT` at line 1099. This mismatch will cause OpenCode to fail when trying to resolve these models because it won't find a provider with ID `openai`.

These model references should either:
1. Be changed to `cchGPT/gpt-5.2` and `cchGPT/gpt-5.2-small` to match the provider name, OR
2. The provider at line 1099 should be renamed from `cchGPT` to `openai`

Based on the i18n examples (which use `openai/gpt-5.2`) and the test expectations, option 2 (renaming provider to `openai`) appears to be the intended fix.

How can I resolve this? If you propose a fix, please make it concise.

provider: {
cchClaude: {
npm: "@ai-sdk/anthropic",
Expand All @@ -1100,16 +1102,34 @@ gemini`}
options: {
baseURL: `${resolvedOrigin}/v1`,
apiKey: "{env:CCH_API_KEY}",
store: false,
setCacheKey: true,
},
models: {
"gpt-5.2": { name: "GPT-5.2" },
"gpt-5.2": {
name: "GPT-5.2",
options: {
reasoningEffort: "xhigh",
store: false,
include: ["reasoning.encrypted_content"],
},
},
"gpt-5.2-small": {
id: "gpt-5.2",
name: "GPT-5.2 Small",
options: {
reasoningEffort: "medium",
store: false,
include: ["reasoning.encrypted_content"],
},
},
},
},
cchGemini: {
npm: "@ai-sdk/google",
name: "Gemini via cch",
options: {
baseURL: `${resolvedOrigin}/v1`,
baseURL: `${resolvedOrigin}/v1beta`,
apiKey: "{env:CCH_API_KEY}",
},
models: {
Expand Down
12 changes: 11 additions & 1 deletion tests/unit/usage-doc/opencode-usage-doc.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,28 @@ describe("UsageDoc - OpenCode 配置教程", () => {
expect(text).toContain('"baseURL": "http://localhost:23000/v1"');

expect(text).toContain('"npm": "@ai-sdk/anthropic"');
expect(text).toContain('"npm": "@ai-sdk/openai"');
expect(text).toContain('"npm": "@ai-sdk/google"');
expect(text).not.toContain('"npm": "@ai-sdk/openai"');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This test assertion appears to be incorrect. The UsageDocContent component generates a configuration that includes "npm": "@ai-sdk/openai" for the cchGPT provider. Therefore, this not.toContain assertion will fail. It seems the original toContain was correct.

Suggested change
expect(text).not.toContain('"npm": "@ai-sdk/openai"');
expect(text).toContain('"npm": "@ai-sdk/openai"');

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

rg -n "@ai-sdk/openai" --type=ts --type=tsx -g '!node_modules/**'

Repository: ding113/claude-code-hub

Length of output: 94


🏁 Script executed:

head -n 95 tests/unit/usage-doc/opencode-usage-doc.test.tsx | tail -n 30

Repository: ding113/claude-code-hub

Length of output: 1351


🏁 Script executed:

git log --oneline -n 20 -- tests/unit/usage-doc/opencode-usage-doc.test.tsx

Repository: ding113/claude-code-hub

Length of output: 153


🏁 Script executed:

find . -name "page.tsx" -path "*/usage-doc/*" -type f

Repository: ding113/claude-code-hub

Length of output: 104


🏁 Script executed:

rg -n "ai-sdk/openai" -t=ts -t=jsx -t=js -g '!node_modules' -g '!*.test.*'

Repository: ding113/claude-code-hub

Length of output: 94


🏁 Script executed:

fd -e tsx -e ts "usage-doc" | grep -E "(page|config)" | head -20

Repository: ding113/claude-code-hub

Length of output: 111


🏁 Script executed:

cat -n ./src/app/[locale]/usage-doc/page.tsx | head -200

Repository: ding113/claude-code-hub

Length of output: 7379


🏁 Script executed:

grep -n "openai\|@ai-sdk" ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 500


🏁 Script executed:

sed -n '1080,1110p' ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 1123


🏁 Script executed:

sed -n '1095,1135p' ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 1377


🏁 Script executed:

git diff ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 49


🏁 Script executed:

git status ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 132


🏁 Script executed:

cat -n tests/unit/usage-doc/opencode-usage-doc.test.tsx

Repository: ding113/claude-code-hub

Length of output: 6386


🏁 Script executed:

sed -n '1050,1200p' ./src/app/[locale]/usage-doc/page.tsx | grep -n "CodeBlock\|config\|JSON\|stringify"

Repository: ding113/claude-code-hub

Length of output: 1501


🏁 Script executed:

grep -n "JSON.stringify\|<CodeBlock" ./src/app/[locale]/usage-doc/page.tsx | head -20

Repository: ding113/claude-code-hub

Length of output: 791


🏁 Script executed:

sed -n '1070,1160p' ./src/app/[locale]/usage-doc/page.tsx

Repository: ding113/claude-code-hub

Length of output: 3184


配置中 @ai-sdk/openai 的移除与测试不匹配

第 73 行的断言 expect(text).not.toContain('"npm": "@ai-sdk/openai"') 与实现存在矛盾。page.tsx 第 1100 行的 cchGPT 提供商配置中明确包含 npm: "@ai-sdk/openai",该配置通过 JSON.stringify() 序列化后将包含 "npm": "@ai-sdk/openai" 字符串,导致该测试断言失败。

需要对齐实现与测试:要么从 cchGPT 提供商中移除 @ai-sdk/openai,要么将测试断言改为 toContain

🤖 Prompt for AI Agents
In @tests/unit/usage-doc/opencode-usage-doc.test.tsx at line 73, The test in
tests/unit/usage-doc/opencode-usage-doc.test.tsx asserts the serialized page
content does NOT contain '"npm": "@ai-sdk/openai"', but the cchGPT provider in
page.tsx (the cchGPT configuration at/near the cchGPT provider object) includes
npm: "@ai-sdk/openai", so either remove that npm entry from the cchGPT provider
configuration or update the test assertion to expect the string to be present
(change expect(text).not.toContain('"npm": "@ai-sdk/openai"') to
expect(text).toContain('"npm": "@ai-sdk/openai"')). Locate the cchGPT provider
object in page.tsx and the failing assertion in opencode-usage-doc.test.tsx and
make the change so implementation and test match.

expect(text).not.toContain("@ai-sdk/openai-compatible");

expect(text).toContain("claude-haiku-4-5-20251001");
expect(text).toContain("claude-sonnet-4-5-20250929");
expect(text).toContain("claude-opus-4-5-20251101");

expect(text).toContain('"model": "openai/gpt-5.2"');
expect(text).toContain('"small_model": "openai/gpt-5.2-small"');

expect(text).toContain("gpt-5.2");
expect(text).toContain("gpt-5.2-small");
expect(text).toContain('"reasoningEffort": "xhigh"');
expect(text).toContain('"reasoningEffort": "medium"');
expect(text).toContain('"store": false');
expect(text).toContain('"setCacheKey": true');
expect(text).toContain("reasoning.encrypted_content");

expect(text).toContain("gemini-3-pro-preview");
expect(text).toContain("gemini-3-flash-preview");
expect(text).toContain('"baseURL": "http://localhost:23000/v1beta"');

unmount();
});
Expand Down
Loading