mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 00:35:32 +08:00
cc235c6c63
Replace the provider switching mechanism for Claude/Codex/Gemini from full settings_config overwrite to partial key-field replacement, preserving user's non-provider settings (plugins, MCP, permissions, etc.) across switches. - Add write_live_partial() with per-app implementations for Claude (JSON env merge), Codex (auth replace + TOML partial merge), and Gemini (env merge) - Add backfill_key_fields() to extract only provider-specific fields when saving live config back to provider entries - Update switch_normal, sync_current_to_live, add, update to use partial merge - Remove common config snippet feature for Claude/Codex/Gemini (no longer needed with partial merging); preserve OMO common config - Delete 6 frontend files (3 components + 3 hooks), clean up 11 modified files - Remove backend extract_common_config_* methods, 3 Tauri commands, CommonConfigSnippets struct, and related migration code - Update integration tests to validate key-field-only backfill behavior
50 lines
964 B
TypeScript
50 lines
964 B
TypeScript
import React from "react";
|
|
import { CodexAuthSection, CodexConfigSection } from "./CodexConfigSections";
|
|
|
|
interface CodexConfigEditorProps {
|
|
authValue: string;
|
|
|
|
configValue: string;
|
|
|
|
onAuthChange: (value: string) => void;
|
|
|
|
onConfigChange: (value: string) => void;
|
|
|
|
onAuthBlur?: () => void;
|
|
|
|
authError: string;
|
|
|
|
configError: string;
|
|
}
|
|
|
|
const CodexConfigEditor: React.FC<CodexConfigEditorProps> = ({
|
|
authValue,
|
|
configValue,
|
|
onAuthChange,
|
|
onConfigChange,
|
|
onAuthBlur,
|
|
authError,
|
|
configError,
|
|
}) => {
|
|
return (
|
|
<div className="space-y-6">
|
|
{/* Auth JSON Section */}
|
|
<CodexAuthSection
|
|
value={authValue}
|
|
onChange={onAuthChange}
|
|
onBlur={onAuthBlur}
|
|
error={authError}
|
|
/>
|
|
|
|
{/* Config TOML Section */}
|
|
<CodexConfigSection
|
|
value={configValue}
|
|
onChange={onConfigChange}
|
|
configError={configError}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default CodexConfigEditor;
|