feat(ui): 添加配置错误 toast 提示
当 Provider API Key 未配置时,显示 toast 提示并提供 "去配置"按钮,点击可直接打开 Providers 配置面板
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { WifiOff, MessageSquare, Settings, FolderOpen, Terminal, Plug, Zap, Bot, History, Server } from 'lucide-react';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { toast } from 'sonner';
|
||||
import {
|
||||
useChat,
|
||||
ChatMessage,
|
||||
@@ -64,6 +65,17 @@ export function ChatPage({
|
||||
},
|
||||
onSessionNotFound,
|
||||
onSessionUpdated,
|
||||
onConfigError: (error) => {
|
||||
toast.error(error.message, {
|
||||
duration: 10000,
|
||||
action: onOpenProviders
|
||||
? {
|
||||
label: '去配置',
|
||||
onClick: onOpenProviders,
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const messagesEndRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
Reference in New Issue
Block a user