mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
fix: hide ClaudeQuickToggles when creating a new provider
The quick toggles (hide AI attribution, extended thinking, teammates mode) patch the live config of the currently active provider, which is incorrect during provider creation. Only show them in edit mode.
This commit is contained in:
@@ -1496,22 +1496,24 @@ export function ProviderForm({
|
|||||||
<Label htmlFor="settingsConfig">
|
<Label htmlFor="settingsConfig">
|
||||||
{t("claudeConfig.configLabel")}
|
{t("claudeConfig.configLabel")}
|
||||||
</Label>
|
</Label>
|
||||||
<ClaudeQuickToggles
|
{isEditMode && (
|
||||||
onPatchApplied={(patch) => {
|
<ClaudeQuickToggles
|
||||||
try {
|
onPatchApplied={(patch) => {
|
||||||
const cfg = JSON.parse(
|
try {
|
||||||
form.getValues("settingsConfig") || "{}",
|
const cfg = JSON.parse(
|
||||||
);
|
form.getValues("settingsConfig") || "{}",
|
||||||
jsonMergePatch(cfg, patch);
|
);
|
||||||
form.setValue(
|
jsonMergePatch(cfg, patch);
|
||||||
"settingsConfig",
|
form.setValue(
|
||||||
JSON.stringify(cfg, null, 2),
|
"settingsConfig",
|
||||||
);
|
JSON.stringify(cfg, null, 2),
|
||||||
} catch {
|
);
|
||||||
// invalid JSON in editor — skip mirror
|
} catch {
|
||||||
}
|
// invalid JSON in editor — skip mirror
|
||||||
}}
|
}
|
||||||
/>
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<JsonEditor
|
<JsonEditor
|
||||||
value={form.watch("settingsConfig")}
|
value={form.watch("settingsConfig")}
|
||||||
onChange={(value) => form.setValue("settingsConfig", value)}
|
onChange={(value) => form.setValue("settingsConfig", value)}
|
||||||
|
|||||||
Reference in New Issue
Block a user