diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx index 2dddd50..61eb91b 100644 --- a/src/app/settings/page.tsx +++ b/src/app/settings/page.tsx @@ -50,6 +50,7 @@ export default function SettingsPage() { const { tools, loading: toolsLoading } = useTools(); // CCH 配置状态 + const [cchUrl, setCchUrl] = useState(''); const [cchApiKey, setCchApiKey] = useState(''); const [showApiKey, setShowApiKey] = useState(false); const [saveStatus, setSaveStatus] = useState<'idle' | 'saving' | 'saved' | 'error'>('idle'); @@ -68,6 +69,7 @@ export default function SettingsPage() { // 当设置加载完成后,更新本地状态 useEffect(() => { if (settings) { + setCchUrl(settings.cchUrl || ''); setSystemPrompt(settings.systemPrompt || ''); setTemperature(settings.temperature || '0.7'); } @@ -77,8 +79,12 @@ export default function SettingsPage() { const handleSaveCchConfig = async () => { setSaveStatus('saving'); try { - if (cchApiKey) { - await updateSettings({ cchApiKey }); + const updates: Record = {}; + if (cchUrl) updates.cchUrl = cchUrl; + if (cchApiKey) updates.cchApiKey = cchApiKey; + + if (Object.keys(updates).length > 0) { + await updateSettings(updates); } setSaveStatus('saved'); setCchApiKey(''); // 清除输入的 API Key @@ -313,6 +319,20 @@ export default function SettingsPage() { title="CCH 服务配置" description="配置 Claude Code Hub 服务连接" > + {/* 服务地址配置 */} + + setCchUrl(e.target.value)} + placeholder="https://claude.leocoder.cn/" + /> + +