diff --git a/src/app/chat/[id]/page.tsx b/src/app/chat/[id]/page.tsx
index 8c98a30..9f47244 100644
--- a/src/app/chat/[id]/page.tsx
+++ b/src/app/chat/[id]/page.tsx
@@ -2,7 +2,8 @@
import { useState, useRef, useEffect, use } from 'react';
import { useRouter, useSearchParams } from 'next/navigation';
-import { Share2, MoreHorizontal, Loader2, Square, Clock, ChevronDown, Pencil, Trash2, Check, X } from 'lucide-react';
+import Link from 'next/link';
+import { Share2, MoreHorizontal, Loader2, Square, Clock, ChevronDown, Pencil, Trash2, Check, X, AlertTriangle, Settings } from 'lucide-react';
import { Sidebar, SidebarToggle } from '@/components/layout/Sidebar';
import { ChatInput } from '@/components/features/ChatInput';
import { MessageBubble } from '@/components/features/MessageBubble';
@@ -448,6 +449,30 @@ export default function ChatPage({ params }: PageProps) {
{/* 消息列表区域 */}
+ {/* API Key 未配置提示 */}
+ {!settings?.cchApiKeyConfigured && (
+
+
+
+
+
+ 请先配置 API Key
+
+
+ 您需要配置自己的 API Key 才能使用 AI 对话功能。请前往设置页面完成配置。
+
+
+
+ 前往设置
+
+
+
+
+ )}
+
{messages.length === 0 ? (
diff --git a/src/app/settings/page.tsx b/src/app/settings/page.tsx
index cff7f51..2dddd50 100644
--- a/src/app/settings/page.tsx
+++ b/src/app/settings/page.tsx
@@ -50,7 +50,6 @@ 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');
@@ -69,7 +68,6 @@ export default function SettingsPage() {
// 当设置加载完成后,更新本地状态
useEffect(() => {
if (settings) {
- setCchUrl(settings.cchUrl || '');
setSystemPrompt(settings.systemPrompt || '');
setTemperature(settings.temperature || '0.7');
}
@@ -79,11 +77,9 @@ export default function SettingsPage() {
const handleSaveCchConfig = async () => {
setSaveStatus('saving');
try {
- const updates: Record = { cchUrl };
if (cchApiKey) {
- updates.cchApiKey = cchApiKey;
+ await updateSettings({ cchApiKey });
}
- await updateSettings(updates);
setSaveStatus('saved');
setCchApiKey(''); // 清除输入的 API Key
setTimeout(() => setSaveStatus('idle'), 2000);
@@ -317,19 +313,6 @@ export default function SettingsPage() {
title="CCH 服务配置"
description="配置 Claude Code Hub 服务连接"
>
-
- setCchUrl(e.target.value)}
- placeholder="http://localhost:13500"
- />
-
-