|
@@ -1,21 +1,25 @@
|
|
|
import * as React from 'react';
|
|
import * as React from 'react';
|
|
|
import { useNavigate } from "react-router-dom";
|
|
import { useNavigate } from "react-router-dom";
|
|
|
-import { Dropdown, Spin } from 'antd';
|
|
|
|
|
|
|
+import { Dropdown, Spin, Input, Button, Space } from 'antd';
|
|
|
import { Chat } from './DeepSeekChat';
|
|
import { Chat } from './DeepSeekChat';
|
|
|
import whiteLogo from "../icons/whiteLogo.png";
|
|
import whiteLogo from "../icons/whiteLogo.png";
|
|
|
import jkxz from "../icons/jkxz.png";
|
|
import jkxz from "../icons/jkxz.png";
|
|
|
import { useChatStore } from "../store";
|
|
import { useChatStore } from "../store";
|
|
|
import { useMobileScreen } from '../utils';
|
|
import { useMobileScreen } from '../utils';
|
|
|
import api from "@/app/api/api";
|
|
import api from "@/app/api/api";
|
|
|
|
|
+import { SideBar } from './sidebar';
|
|
|
import './deepSeekHome.scss';
|
|
import './deepSeekHome.scss';
|
|
|
|
|
|
|
|
|
|
+const { TextArea } = Input;
|
|
|
|
|
+
|
|
|
const DeekSeek: React.FC = () => {
|
|
const DeekSeek: React.FC = () => {
|
|
|
const chatStore = useChatStore();
|
|
const chatStore = useChatStore();
|
|
|
const isMobileScreen = useMobileScreen();
|
|
const isMobileScreen = useMobileScreen();
|
|
|
-
|
|
|
|
|
const navigate = useNavigate();
|
|
const navigate = useNavigate();
|
|
|
|
|
|
|
|
const [listLoading, setListLoading] = React.useState(false);
|
|
const [listLoading, setListLoading] = React.useState(false);
|
|
|
|
|
+ const [isChatActive, setIsChatActive] = React.useState(false); // 新增状态:聊天是否激活
|
|
|
|
|
+ const [userInput, setUserInput] = React.useState(''); // 新增状态:用户输入
|
|
|
|
|
|
|
|
type List = {
|
|
type List = {
|
|
|
title: string,
|
|
title: string,
|
|
@@ -51,83 +55,124 @@ const DeekSeek: React.FC = () => {
|
|
|
}
|
|
}
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
+ // 处理发送消息
|
|
|
|
|
+ const handleSend = () => {
|
|
|
|
|
+ if (userInput.trim()) {
|
|
|
|
|
+ setIsChatActive(true);
|
|
|
|
|
+ // 这里可以添加发送消息的逻辑
|
|
|
|
|
+ console.log('发送消息:', userInput);
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 处理输入框点击,激活聊天界面
|
|
|
|
|
+ const handleInputClick = () => {
|
|
|
|
|
+ setIsChatActive(true);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // 重置到初始状态
|
|
|
|
|
+ const resetToHome = () => {
|
|
|
|
|
+ setIsChatActive(false);
|
|
|
|
|
+ setUserInput('');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<Spin spinning={listLoading}>
|
|
<Spin spinning={listLoading}>
|
|
|
<div className='deekSeek'>
|
|
<div className='deekSeek'>
|
|
|
- <div className='deekSeek-header' style={{ justifyContent: isMobileScreen ? 'flex-start' : 'center' }}>
|
|
|
|
|
- <div style={{ display: 'flex', alignItems: 'center', margin: '0 20px' }}>
|
|
|
|
|
- <img src={whiteLogo.src} style={{ width: 20, marginRight: 10 }} />
|
|
|
|
|
- <div style={{ whiteSpace: 'nowrap' }}>
|
|
|
|
|
- 上海建科
|
|
|
|
|
|
|
+ {/* 左侧 Sidebar */}
|
|
|
|
|
+ <SideBar />
|
|
|
|
|
+
|
|
|
|
|
+ {/* 主要区域 */}
|
|
|
|
|
+ <div className='deekSeek-main'>
|
|
|
|
|
+ {!isChatActive ? (
|
|
|
|
|
+ // 未交互状态:显示简化对话框
|
|
|
|
|
+ <div className='deekSeek-content'>
|
|
|
|
|
+ <div className='deekSeek-content-title'>
|
|
|
|
|
+ <img src={jkxz.src} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className='deekSeek-content-title-sm' style={{ marginBottom: isMobileScreen ? 14 : 20 }}>
|
|
|
|
|
+ 您好, 我是小智文件处理助手!
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 输入区域 */}
|
|
|
|
|
+ <div className='deekSeek-input-section'>
|
|
|
|
|
+ <div className='deekSeek-input-tabs'>
|
|
|
|
|
+ <Button className='deekSeek-tab-button active'>
|
|
|
|
|
+ <span className='deekSeek-tab-icon'>⚛️</span>
|
|
|
|
|
+ DeepSeek-R1
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button className='deekSeek-tab-button'>
|
|
|
|
|
+ <span className='deekSeek-tab-icon'>🌐</span>
|
|
|
|
|
+ 联网搜索
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <div className='deekSeek-input-container' onClick={handleInputClick}>
|
|
|
|
|
+ <TextArea
|
|
|
|
|
+ value={userInput}
|
|
|
|
|
+ onChange={(e) => setUserInput(e.target.value)}
|
|
|
|
|
+ placeholder="输入您的问题或需求, Control+Enter换行"
|
|
|
|
|
+ className='deekSeek-main-input'
|
|
|
|
|
+ autoSize={{ minRows: 3, maxRows: 6 }}
|
|
|
|
|
+ onKeyDown={(e) => {
|
|
|
|
|
+ if (e.ctrlKey && e.key === 'Enter') {
|
|
|
|
|
+ handleSend();
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ onClick={(e) => e.stopPropagation()} // 阻止事件冒泡
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <div className='deekSeek-input-actions'>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type='text'
|
|
|
|
|
+ className='deekSeek-clear-button'
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ setUserInput('');
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ ✕
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type='primary'
|
|
|
|
|
+ className='deekSeek-send-button'
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ handleSend();
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ ✈️
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {/* 底部提示 */}
|
|
|
|
|
+ <div className='deekSeek-footer-text'>
|
|
|
|
|
+ 内容由AI生成,仅供参考
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- {
|
|
|
|
|
- list.map((item, index) => {
|
|
|
|
|
- return <Dropdown
|
|
|
|
|
- menu={{
|
|
|
|
|
- items: item.children.map((child, i) => {
|
|
|
|
|
- return {
|
|
|
|
|
- key: 'child' + i,
|
|
|
|
|
- label: <div
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- const search = `?showMenu=${child.showMenu}&chatMode=${child.chatMode}&appId=${child.appId}`;
|
|
|
|
|
- if (child.appId) {
|
|
|
|
|
- navigate({
|
|
|
|
|
- pathname: '/knowledgeChat',
|
|
|
|
|
- search: search,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- {child.title}
|
|
|
|
|
- </div>,
|
|
|
|
|
- children: child.children ? child.children.map((record, ind) => {
|
|
|
|
|
- return {
|
|
|
|
|
- key: 'record' + ind,
|
|
|
|
|
- label: <div
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- const search = `?showMenu=${record.showMenu}&chatMode=${record.chatMode}&appId=${record.appId}`;
|
|
|
|
|
- if (record.appId) {
|
|
|
|
|
- navigate({
|
|
|
|
|
- pathname: '/knowledgeChat',
|
|
|
|
|
- search: search,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- {record.title}
|
|
|
|
|
- </div>
|
|
|
|
|
- };
|
|
|
|
|
- }) : undefined,
|
|
|
|
|
- };
|
|
|
|
|
- })
|
|
|
|
|
- }}
|
|
|
|
|
- key={index}
|
|
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ // 激活状态:显示完整对话界面
|
|
|
|
|
+ <div className='deekSeek-content'>
|
|
|
|
|
+ <div className='deekSeek-content-title'>
|
|
|
|
|
+ <img src={jkxz.src} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className='deekSeek-content-title-sm' style={{ marginBottom: isMobileScreen ? 14 : 20 }}>
|
|
|
|
|
+ 智能问答助手
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={isMobileScreen ? 'deekSeek-content-mobile' : 'deekSeek-content-pc'}>
|
|
|
|
|
+ <Chat />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {/* 返回按钮 */}
|
|
|
|
|
+ <Button
|
|
|
|
|
+ className='deekSeek-back-button'
|
|
|
|
|
+ onClick={resetToHome}
|
|
|
|
|
+ style={{ marginTop: 20 }}
|
|
|
>
|
|
>
|
|
|
- <div style={{ whiteSpace: 'nowrap', marginRight: 20, color: '#98b4fa', cursor: 'pointer' }}>
|
|
|
|
|
- {item.title}
|
|
|
|
|
- </div>
|
|
|
|
|
- </Dropdown>
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- {/*<div style={{ whiteSpace: 'nowrap', marginRight: 20, color: '#98b4fa', cursor: 'pointer' }} onClick={() => {*/}
|
|
|
|
|
- {/* navigate({*/}
|
|
|
|
|
- {/* pathname: '/deepseekChat',*/}
|
|
|
|
|
- {/* })*/}
|
|
|
|
|
- {/*}}>*/}
|
|
|
|
|
- {/* DeepSeek问答*/}
|
|
|
|
|
- {/*</div>*/}
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className='deekSeek-content'>
|
|
|
|
|
- <div className='deekSeek-content-title'>
|
|
|
|
|
- <img src={jkxz.src} />
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className='deekSeek-content-title-sm' style={{ marginBottom: isMobileScreen ? 14 : 20 }}>
|
|
|
|
|
- 智能问答助手
|
|
|
|
|
- </div>
|
|
|
|
|
- <div className={isMobileScreen ? 'deekSeek-content-mobile' : 'deekSeek-content-pc'}>
|
|
|
|
|
- <Chat />
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ 返回首页
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</Spin>
|
|
</Spin>
|