mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
feat(claude): add "Disable Artifact Tool" quick toggle to provider editor
Some third-party Anthropic-compatible gateways (e.g. DeepSeek) validate
tool JSON Schemas with a strict regex checker and reject the Unicode
property escapes (\p{Cc}...) that Claude Code's Artifact tool emits when
its str_replace db capability is rolled out, failing every request with
400 "Invalid schema for function 'Artifact'". The failure is independent
of the model selected.
Add a sixth checkbox next to the existing Claude quick toggles that sets
env.CLAUDE_CODE_DISABLE_ARTIFACT="1" on the provider, which keeps the
Artifact tool out of the tools array entirely. Unchecking removes the key
like the other toggles do. Labels added for zh/en/ja/zh-TW and the user
manual toggle table updated in zh/en/ja.
This commit is contained in:
1 parent
5e1292736e
commit
deb0e874ff
8 files changed
+38
-4
No files matched your search
@@ -548,6 +548,7 @@ When editing Claude providers, a set of **quick toggles** is available above the
|
||||
| **Enable Tool Search** | Enables tool search functionality | Sets `env.ENABLE_TOOL_SEARCH = "true"` |
|
||||
| **Max Effort** | Sets effort level to max | Sets `env.CLAUDE_CODE_EFFORT_LEVEL = "max"` |
|
||||
| **Disable Auto Upgrade** | Prevents Claude Code auto-updates | Sets `env.DISABLE_AUTOUPDATER = "1"` |
|
||||
| **Disable Artifact Tool** | Keeps the Artifact tool out of the request's tools array (some third-party gateways reject its schema and return 400 on every request) | Sets `env.CLAUDE_CODE_DISABLE_ARTIFACT = "1"` |
|
||||
|
||||
When a toggle is unchecked, its corresponding config entry is removed entirely. Changes are reflected in the JSON editor in real-time.
|
||||
|
||||
|
||||
@@ -548,6 +548,7 @@ Claude プロバイダーの編集時、JSON エディタの上部に **クイ
|
||||
| **ツール検索を有効化** | ツール検索機能を有効化 | `env.ENABLE_TOOL_SEARCH = "true"` を設定 |
|
||||
| **最大強度思考** | エフォートレベルを max に設定 | `env.CLAUDE_CODE_EFFORT_LEVEL = "max"` を設定 |
|
||||
| **自動アップグレードを無効化** | Claude Code の自動更新を防止 | `env.DISABLE_AUTOUPDATER = "1"` を設定 |
|
||||
| **Artifact ツールを無効化** | Artifact ツールをリクエストの tools 配列に含めない(一部のサードパーティゲートウェイはそのスキーマ検証に失敗し、すべてのリクエストで 400 を返す) | `env.CLAUDE_CODE_DISABLE_ARTIFACT = "1"` を設定 |
|
||||
|
||||
トグルのチェックを外すと、対応する設定エントリが完全に削除されます。変更は JSON エディタにリアルタイムで反映されます。
|
||||
|
||||
|
||||
@@ -548,6 +548,7 @@ v3.13.0 起新增的高级选项。默认情况下,CC Switch 会把配置的 `
|
||||
| **启用工具搜索** | 启用工具搜索功能 | 设置 `env.ENABLE_TOOL_SEARCH = "true"` |
|
||||
| **最大强度思考** | 将 effort 级别设为 max | 设置 `env.CLAUDE_CODE_EFFORT_LEVEL = "max"` |
|
||||
| **禁用自动更新** | 阻止 Claude Code 自动更新 | 设置 `env.DISABLE_AUTOUPDATER = "1"` |
|
||||
| **禁用 Artifact 工具** | 不把 Artifact 工具放进请求的 tools 数组(部分第三方网关会因其 schema 校验失败而对每个请求返回 400) | 设置 `env.CLAUDE_CODE_DISABLE_ARTIFACT = "1"` |
|
||||
|
||||
取消勾选开关时,对应的配置项会被完全移除。更改会实时反映在 JSON 编辑器中。
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ export function CommonConfigEditor({
|
||||
disableAutoUpgrade:
|
||||
config?.env?.DISABLE_AUTOUPDATER === "1" ||
|
||||
config?.env?.DISABLE_AUTOUPDATER === 1,
|
||||
disableArtifact:
|
||||
config?.env?.CLAUDE_CODE_DISABLE_ARTIFACT === "1" ||
|
||||
config?.env?.CLAUDE_CODE_DISABLE_ARTIFACT === 1,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
@@ -93,6 +96,7 @@ export function CommonConfigEditor({
|
||||
enableToolSearch: false,
|
||||
effortMax: false,
|
||||
disableAutoUpgrade: false,
|
||||
disableArtifact: false,
|
||||
};
|
||||
}
|
||||
}, [localValue]);
|
||||
@@ -146,6 +150,18 @@ export function CommonConfigEditor({
|
||||
if (Object.keys(config.env).length === 0) delete config.env;
|
||||
}
|
||||
break;
|
||||
case "disableArtifact":
|
||||
// 第三方网关(如 DeepSeek)用严格 JSON Schema 校验工具定义,
|
||||
// Artifact 工具灰度中的 \p{..} 正则会让每个请求 400;
|
||||
// 该变量让 Claude Code 压根不把 Artifact 放进 tools 数组。
|
||||
if (!config.env) config.env = {};
|
||||
if (checked) {
|
||||
config.env.CLAUDE_CODE_DISABLE_ARTIFACT = "1";
|
||||
} else {
|
||||
delete config.env.CLAUDE_CODE_DISABLE_ARTIFACT;
|
||||
if (Object.keys(config.env).length === 0) delete config.env;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
handleLocalChange(JSON.stringify(config, null, 2));
|
||||
@@ -246,6 +262,17 @@ export function CommonConfigEditor({
|
||||
/>
|
||||
<span>{t("claudeConfig.disableAutoUpgrade")}</span>
|
||||
</label>
|
||||
<label className="inline-flex items-center gap-2 text-sm text-muted-foreground cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={toggleStates.disableArtifact}
|
||||
onChange={(e) =>
|
||||
handleToggle("disableArtifact", e.target.checked)
|
||||
}
|
||||
className="w-4 h-4 text-blue-500 bg-white dark:bg-gray-800 border-border-default rounded focus:ring-blue-500 dark:focus:ring-blue-400 focus:ring-2"
|
||||
/>
|
||||
<span>{t("claudeConfig.disableArtifact")}</span>
|
||||
</label>
|
||||
</div>
|
||||
<JsonEditor
|
||||
value={localValue}
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
"enableTeammates": "Teammates Mode",
|
||||
"enableToolSearch": "Enable Tool Search",
|
||||
"effortMax": "Max Effort Thinking",
|
||||
"disableAutoUpgrade": "Disable Auto-Upgrade"
|
||||
"disableAutoUpgrade": "Disable Auto-Upgrade",
|
||||
"disableArtifact": "Disable Artifact Tool"
|
||||
},
|
||||
"header": {
|
||||
"viewOnGithub": "View on GitHub",
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
"enableTeammates": "Teammates モード",
|
||||
"enableToolSearch": "Tool Search を有効化",
|
||||
"effortMax": "最大強度思考",
|
||||
"disableAutoUpgrade": "自動アップグレードを無効化"
|
||||
"disableAutoUpgrade": "自動アップグレードを無効化",
|
||||
"disableArtifact": "Artifact ツールを無効化"
|
||||
},
|
||||
"header": {
|
||||
"viewOnGithub": "GitHub で見る",
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
"enableTeammates": "Teammates 模式",
|
||||
"enableToolSearch": "啟用 Tool Search",
|
||||
"effortMax": "最大強度思考",
|
||||
"disableAutoUpgrade": "停用自動升級"
|
||||
"disableAutoUpgrade": "停用自動升級",
|
||||
"disableArtifact": "停用 Artifact 工具"
|
||||
},
|
||||
"header": {
|
||||
"viewOnGithub": "在 GitHub 上檢視",
|
||||
|
||||
@@ -84,7 +84,8 @@
|
||||
"enableTeammates": "Teammates 模式",
|
||||
"enableToolSearch": "启用 Tool Search",
|
||||
"effortMax": "最大强度思考",
|
||||
"disableAutoUpgrade": "禁用自动升级"
|
||||
"disableAutoUpgrade": "禁用自动升级",
|
||||
"disableArtifact": "禁用 Artifact 工具"
|
||||
},
|
||||
"header": {
|
||||
"viewOnGithub": "在 GitHub 上查看",
|
||||
|
||||
Reference in new issue
Block a user