From 92ab731c62925d1ab8aa5b2dd5a4592fa956e56c Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Sun, 21 Dec 2025 16:03:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=AE=BE=E7=BD=AE):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20CCH=20=E6=9C=8D=E5=8A=A1=E5=9C=B0=E5=9D=80=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增服务地址输入框,支持自定义 CCH 服务 URL - 服务地址与 API Key 一起保存到用户设置 - 页面加载时自动填充已保存的服务地址 --- src/app/settings/page.tsx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) 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/" + /> + +