import * as React from 'react'; import { useNavigate } from "react-router-dom"; import { Dropdown, Spin, Input, Button, Space } from 'antd'; import { Chat } from './DeepSeekChat'; import whiteLogo from "../icons/whiteLogo.png"; import jkxz from "../icons/jkxz.png"; import { useChatStore } from "../store"; import { useMobileScreen } from '../utils'; import api from "@/app/api/api"; import { SideBar } from './sidebar'; import './deepSeekHome.scss'; const { TextArea } = Input; const DeekSeek: React.FC = () => { const chatStore = useChatStore(); const isMobileScreen = useMobileScreen(); const navigate = useNavigate(); const [listLoading, setListLoading] = React.useState(false); const [isChatActive, setIsChatActive] = React.useState(false); // 新增状态:聊天是否激活 const [userInput, setUserInput] = React.useState(''); // 新增状态:用户输入 type List = { title: string, children: { title: string, showMenu: string, chatMode: string, appId: string, children: List[number]['children'], }[], }[]; const [list, setList] = React.useState([]); const init = async () => { setListLoading(true); try { const res = await api.get('/deepseek/api/appType'); setList(res.data); } catch (error) { console.error(error); } finally { setListLoading(false); } } React.useEffect(() => { chatStore.clearSessions(); const userInfo = localStorage.getItem('userInfo'); if (userInfo) { init(); } }, []); // 处理发送消息 const handleSend = () => { if (userInput.trim()) { setIsChatActive(true); // 这里可以添加发送消息的逻辑 console.log('发送消息:', userInput); } }; // 处理输入框点击,激活聊天界面 const handleInputClick = () => { setIsChatActive(true); }; // 重置到初始状态 const resetToHome = () => { setIsChatActive(false); setUserInput(''); }; return (
{/* 左侧 Sidebar */} {/* 主要区域 */}
{!isChatActive ? ( // 未交互状态:显示简化对话框
您好, 我是小智文件处理助手!
{/* 输入区域 */}