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:
Jason
2026-02-26 09:32:51 +08:00
parent 47435bd647
commit 87604b1809

View File

@@ -1496,22 +1496,24 @@ export function ProviderForm({
<Label htmlFor="settingsConfig">
{t("claudeConfig.configLabel")}
</Label>
<ClaudeQuickToggles
onPatchApplied={(patch) => {
try {
const cfg = JSON.parse(
form.getValues("settingsConfig") || "{}",
);
jsonMergePatch(cfg, patch);
form.setValue(
"settingsConfig",
JSON.stringify(cfg, null, 2),
);
} catch {
// invalid JSON in editor — skip mirror
}
}}
/>
{isEditMode && (
<ClaudeQuickToggles
onPatchApplied={(patch) => {
try {
const cfg = JSON.parse(
form.getValues("settingsConfig") || "{}",
);
jsonMergePatch(cfg, patch);
form.setValue(
"settingsConfig",
JSON.stringify(cfg, null, 2),
);
} catch {
// invalid JSON in editor — skip mirror
}
}}
/>
)}
<JsonEditor
value={form.watch("settingsConfig")}
onChange={(value) => form.setValue("settingsConfig", value)}