import * as React from 'react'; import { useNavigate } from "react-router-dom"; import { Dropdown, Spin,Tooltip } 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 './deepSeekHome.scss'; const DeekSeek: React.FC = () => { const chatStore = useChatStore(); const isMobileScreen = useMobileScreen(); const navigate = useNavigate(); const [listLoading, setListLoading] = React.useState(false); type List = { title: string, children: { title: string, showMenu: string, chatMode: string, appId: string, children?: List[number]['children'], }[], }[]; const [list, setList] = React.useState([ { "children": [ { "chatMode": "LOCAL", "showMenu": "false", "appId": "2935625422066814976", "title": "公司作业指导书(2023版)" }, { "chatMode": "LOCAL", "showMenu": "false", "appId": "2935200536655695872", "title": "常用验收规范问答" }, { "chatMode": "LOCAL", "showMenu": "false", "appId": "2942568790025965568", "title": "钢结构AI监理师" } ], "title": "专业知识" }, { "children": [ { "chatMode": "LOCAL", "showMenu": "false", "appId": "2919677614293913600", "title": "员工入职小百科" }, { "chatMode": "LOCAL", "showMenu": "false", "appId": "2919668410128666624", "title": "数字系统答疑" }, { "chatMode": "LOCAL", "showMenu": "false", "appId": "2945774476037853184", "title": "企业介绍" } ], "title": "职能管理" }, { "children": [], "title": "项目级应用" } ]); 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(); } }, []); return (
上海建科
{ list.map((item, index) => { return { return { key: 'child' + i, label:
{ const search = `?showMenu=${child.showMenu}&chatMode=${child.chatMode}&appId=${child.appId}`; if (child.appId) { navigate({ pathname: '/knowledgeChat', search: search, }) } }} > {child.title}
, children: child.children ? child.children.map((record, ind) => { return { key: 'record' + ind, label:
{ const search = `?showMenu=${record.showMenu}&chatMode=${record.chatMode}&appId=${record.appId}`; if (record.appId) { navigate({ pathname: '/knowledgeChat', search: search, }) } }} > {record.title}
}; }) : undefined, }; }) }} key={index} >
{item.title}
}) } {/*
{*/} {/* navigate({*/} {/* pathname: '/deepseekChat',*/} {/* })*/} {/*}}>*/} {/* DeepSeek问答*/} {/*
*/} {/* 右侧区域 - 开放平台按钮 */}
智能问答助手
); }; export default DeekSeek;