diff --git a/src/pages/chatConversation/ChatConversation.less b/src/pages/chatConversation/ChatConversation.less
index 71ddb7f..af8983a 100644
--- a/src/pages/chatConversation/ChatConversation.less
+++ b/src/pages/chatConversation/ChatConversation.less
@@ -344,7 +344,7 @@
// position: fixed;
left: 0;
right: 0;
- // bottom: -10vh;
+ margin-bottom: 10vh;
// background: linear-gradient(to top, #f5f7fb 40%, rgba(245, 247, 251, 0));
// padding: 32px 0 28px;
z-index: 20;
diff --git a/src/pages/topnavbar/TopNavBar copy.js b/src/pages/topnavbar/TopNavBar copy.js
new file mode 100644
index 0000000..344213d
--- /dev/null
+++ b/src/pages/topnavbar/TopNavBar copy.js
@@ -0,0 +1,524 @@
+import React, { useState, useEffect ,useRef} from 'react'
+import { history, Outlet, useModel, useDispatch, useLocation } from '@umijs/max'
+import styles from './TopNavBar.less'
+import {
+ Menu, Row, Col,
+ Avatar, Dropdown, Button,
+ Layout, theme, Divider, Tooltip, Popover
+} from 'antd'
+import { getPageQuery } from '@/utils/utils'
+import Logo from '@/assets/logo.png'
+import UserAvatar from '@/assets/boy.png'
+import {
+ dataAnalysisStore,
+ conversationStore,
+ writingStore,
+ mobileStore,
+ assistantStore
+} from '@/utils/pageConversationStore'
+import { renderPageContent } from './form/RenderPageContentForm'
+import {
+ SettingOutlined,
+ LogoutOutlined,
+ PlusOutlined,
+ MessageOutlined,
+ DeleteOutlined,
+ HistoryOutlined,
+ DownOutlined,
+ RobotOutlined,
+ BarChartOutlined,
+ CommentOutlined,
+ EditOutlined as WritingIcon,
+ MobileOutlined,
+ RightCircleOutlined,
+ LeftCircleOutlined,
+ AppstoreAddOutlined,
+ AppstoreOutlined,
+
+ ApiOutlined,
+ DeploymentUnitOutlined,
+ BranchesOutlined,
+ DatabaseOutlined,
+ FileTextOutlined,
+} from '@ant-design/icons';
+
+const { Content, Sider } = Layout;
+
+function getItem(label, key, icon, children) {
+ return {
+ key,
+ icon,
+ children,
+ label,
+ };
+}
+
+
+const menuItem = [
+ {
+ label: 'AI助手',
+ key: 'aiqa',
+ icon: '🤖',
+ children: [
+ { label: '智能对话', key: '/topnavbar00/aiqa/conversation', icon: },
+ { label: '智能写作', key: '/topnavbar00/aiqa/writing', icon: },
+ { label: '智能助理', key: '/topnavbar00/aiqa/assistant', icon: },
+ { label: '数据分析', key: '/topnavbar00/aiqa/dataanalysis', icon: },
+ { label: '问答移动端', key: '/topnavbar00/aiqa/mobile', icon: },
+ ]
+ },
+ {
+ label: '系统管理',
+ key: 'system',
+ icon: '⚙️',
+ children: [
+ { label: '插件安装', key: '/topnavbar00/system/plugininstall', icon: },
+ { label: '插件管理', key: '/topnavbar00/system/pluginmanage', icon: },
+ { label: '助理配置', key: '/topnavbar00/system/assistantconfig', icon: },
+ { label: '模型接入', key: '/topnavbar00/system/model', icon: },
+ { label: '应用嵌入', key: '/topnavbar00/system/embed', icon: },
+ { label: '工作流配置', key: '/topnavbar00/system/workflow', icon: },
+ { label: '知识库管理', key: '/topnavbar00/system/knowledge', icon: },
+ { label: '提示词模板管理', key: '/topnavbar00/system/prompts', icon: },
+ ]
+ }
+]
+
+const TopNavBar = (props) => {
+ const dispatch = useDispatch()
+ const { initialState: { menu }, setInitialState } = useModel('@@initialState')
+
+ // 测试时候放开启用本地菜单
+ window.dynamicRoute = menuItem
+ const dynamicRoute = window.dynamicRoute
+ const location = useLocation()
+
+ const pathName = location.pathname
+ const [activeKey, setActiveKey] = useState(pathName ?? '/topnavbar00/aiqa/conversation')
+
+ const [openKeys, setOpenKeys] = useState([])
+ const firstLoadRef = useRef(true)
+ const [menuItems, setMenuItems] = useState([])
+
+
+ const [expandedPage, setExpandedPage] = useState('conversation')
+ const conversationExpanded = expandedPage === 'conversation'
+ const writingExpanded = expandedPage === 'writing'
+ const dataAnalysisExpanded = expandedPage === 'dataanalysis'
+ const assistantExpanded = expandedPage === 'assistant'
+ const mobileExpanded = expandedPage === 'mobile'
+
+ const toggleExpand = (page) => {
+ setExpandedPage(prev => prev === page ? null : page)
+ }
+
+ // 每个页面的对话状态
+ const [dataAnalysisConversations, setDataAnalysisConversations] = useState(dataAnalysisStore.getConversations())
+ const [conversationConversations, setConversationConversations] = useState(conversationStore.getConversations())
+ const [writingConversations, setWritingConversations] = useState(writingStore.getConversations())
+ const [assistantConversations, setAssistantConversations] = useState(assistantStore.getConversations())
+ const [mobileConversations, setMobileConversations] = useState(mobileStore.getConversations())
+
+ const [collapsed, setCollapsed] = useState(false);
+ const toggleCollapsed = () => setCollapsed(c => !c);
+
+ useEffect(() => {
+ if (!dynamicRoute || dynamicRoute?.length === 0) return
+ let newList = []
+
+ if (dynamicRoute?.length) {
+ dynamicRoute?.map(item => {
+ newList.push({
+ key: item?.key,
+ label: item?.label,
+ icon: item?.icon,
+ children: item?.children?.map(child => ({
+ key: child?.key,
+ label: child?.label,
+ icon: child?.icon,
+ }))
+ })
+ })
+
+ // 设置当前激活的菜单项
+ const currentActiveKey = newList?.find(item =>
+ item.children?.some(child => pathName.indexOf(child.key) !== -1)
+ )?.children?.find(child => pathName.indexOf(child.key) !== -1)?.key ?? ''
+ setActiveKey(currentActiveKey)
+
+ // 设置默认展开的菜单
+ const currentOpenKey = newList?.find(item =>
+ item.children?.some(child => pathName.indexOf(child.key) !== -1)
+ )?.key ?? ''
+
+ if (!firstLoadRef.current) {
+ if (currentOpenKey) {
+ setOpenKeys([currentOpenKey])
+ }
+
+ } else {
+ firstLoadRef.current = false
+ }
+ }
+
+ setMenuItems(newList)
+ }, [dynamicRoute, pathName])
+
+ // 订阅每个页面的对话状态变化
+ useEffect(() => {
+ const unsubscribeDataAnalysis = dataAnalysisStore.subscribe(({ conversations }) => {
+ setDataAnalysisConversations(conversations)
+ })
+
+ const unsubscribeConversation = conversationStore.subscribe(({ conversations }) => {
+ setConversationConversations(conversations)
+ })
+
+ const unsubscribeWriting = writingStore.subscribe(({ conversations }) => {
+ setWritingConversations(conversations)
+ })
+
+ const unsubscribeAssistant = assistantStore.subscribe(({ conversations }) => {
+ setAssistantConversations(conversations)
+ })
+
+ const unsubscribeMobile = mobileStore.subscribe(({ conversations }) => {
+ setMobileConversations(conversations)
+ })
+
+ return () => {
+ unsubscribeDataAnalysis()
+ unsubscribeConversation()
+ unsubscribeWriting()
+ unsubscribeAssistant()
+ unsubscribeMobile()
+ }
+ }, [])
+
+ const setRouteActive = value => {
+ const curKey = value.key
+ setActiveKey(curKey)
+ history.replace(curKey)
+ }
+
+ // 处理一级菜单展开/收缩
+ const handleMenuGroupClick = (menuKey) => {
+ if (openKeys.includes(menuKey)) {
+ // 如果已展开,则收缩
+ setOpenKeys(openKeys.filter(key => key !== menuKey))
+ } else {
+ // 如果已收缩,则展开
+ setOpenKeys([...openKeys, menuKey])
+ }
+ }
+
+
+
+
+ const loginOut = async () => {
+ // await outLogin()
+ const { redirect } = getPageQuery()
+ if (window.location.pathname !== '/login/login' && !redirect) {
+ history.replace({
+ pathname: '/login',
+ })
+
+ setInitialState({ currentUser: null, menu: null, menuMap: null })
+ window.dynamicRoute = null
+ localStorage.clear()
+ }
+ }
+
+ const handleMenuClick = (e) => {
+ switch (e.key) {
+ case 'logout':
+ loginOut()
+ break
+ default:
+ break
+ }
+ }
+
+ const dropDownMenuItems = [
+ {
+ label: <>退出登录>,
+ key: 'logout'
+ }
+ ]
+
+ const dropDownMenu = () => (
+
+ )
+
+ const {
+ token: { colorBgContainer, borderRadiusLG },
+ } = theme.useToken();
+
+ const userNameContent = (
+
+
用户小智
+
帮助中心
+
+
+ 用户协议
+ {/*
{userInfo?.user_name_cn ? userInfo.user_name_cn : (userInfo?.user_name || '')} */}
+
+ )
+
+ return (
+
+ {/* 头部功能 */}
+
+
+ {/* 左侧logo */}
+
+
+ AI Q&A
+ {/* 折叠按钮 */}
+
+ {collapsed ? : }
+
+
+
+ {/*
+
+ 你好,欢迎使用 AI 助手
+
+ */}
+ {/* 右侧退出 */}
+
+
+
+
+ {/* 用户名 */}
+ {/* {userInfo?.user_name_cn ? userInfo.user_name_cn : (userInfo?.user_name || '')} */}
+
+
+
+
+
+
+
+ {/* 内容 */}
+
+
+
+
+ {menuItems.map(item => (
+
+
handleMenuGroupClick(item.key)}
+ >
+ {/* 一级菜单 */}
+ {item.icon}{item.label}
+ {/* 一级菜单的下拉按钮 */}
+ {!collapsed && (
+
+ )}
+
+ {item.children && openKeys.includes(item.key) && (
+
+ {item.children.map(child => {
+ // 智能对话页面
+ if (child.key === '/topnavbar00/aiqa/conversation') {
+ return (
+
+
{
+ toggleExpand('conversation')
+ setRouteActive(child)
+
+ }}
+ >
+
+
+ {child.icon}{child.label}
+ {/* */}
+
+ {conversationExpanded &&
+ renderPageContent('conversation',
+ conversationConversations, conversationExpanded,
+ )}
+
+ )
+ }
+ // 智能写作页面
+ if (child.key === '/topnavbar00/aiqa/writing') {
+ return (
+
+
{
+ toggleExpand('writing')
+ setRouteActive(child)
+ }}
+ >
+
+
+ {child.icon}{child.label}
+ {/* */}
+
+ {writingExpanded && renderPageContent('writing',
+ writingConversations, writingExpanded,)}
+
+ )
+ }
+ // 智能助理页面
+ if (child.key === '/topnavbar00/aiqa/assistant') {
+ return (
+
+
{
+ toggleExpand('assistant')
+ setRouteActive(child)
+ }}
+ >
+
+
+ {child.icon}{child.label}
+ {/* */}
+
+ {assistantExpanded && renderPageContent('assistant',
+ assistantConversations, assistantExpanded,)}
+
+ )
+ }
+ // 数据分析页面
+ if (child.key === '/topnavbar00/aiqa/dataanalysis') {
+ return (
+
+
{
+ toggleExpand('dataanalysis')
+ setRouteActive(child)
+ }}
+ >
+
+
+ {child.icon}{child.label}
+ {/* */}
+
+ {dataAnalysisExpanded && renderPageContent('dataanalysis', dataAnalysisConversations,
+ dataAnalysisExpanded,)}
+
+ )
+ }
+ // 问答移动端页面
+ if (child.key === '/topnavbar00/aiqa/mobile') {
+ return (
+
+
{
+ toggleExpand('mobile')
+ setRouteActive(child)
+ setCollapsed(true) // 直接收起
+ }}
+ >
+
+
+ {child.icon}{child.label}
+ {/* */}
+
+ {mobileExpanded && renderPageContent('mobile', mobileConversations,
+ mobileExpanded,)}
+
+ )
+ }
+ // 系统管理内部页面
+ return (
+
setRouteActive(child)}
+ >
+ {child.icon}{child.label}
+
+ )
+ })}
+
+ )}
+
+ ))}
+
+
+
+
+
+ {/* 主题内容区域 */}
+
+
+
+
+
+
+ )
+}
+
+export default TopNavBar
diff --git a/src/pages/topnavbar/TopNavBar.js b/src/pages/topnavbar/TopNavBar.js
index a703771..bdfbf1e 100644
--- a/src/pages/topnavbar/TopNavBar.js
+++ b/src/pages/topnavbar/TopNavBar.js
@@ -7,6 +7,11 @@ import { getPageQuery } from '@/utils/utils'
import Logo from '@/assets/logo.png'
import { userInfo } from '@/utils/globalCommon'
+import {
+ conversationStore,
+} from '@/utils/pageConversationStore'
+import { renderPageContent } from './form/RenderPageContentForm'
+
const menuItem = [
{
label: '效率管理',
@@ -49,7 +54,7 @@ const menuItem = [
// icon: ,
},
{
- label: '智能对话',
+ label: '智能对话',
key: '/topnavbar00/hrefficiency/ChatConversation',
},
// {
@@ -93,6 +98,20 @@ const TopNavBar = (props) => {
const [activeKey, setActiveKey] = useState(pathName ?? '/topnavbar00/home')
const [menuItems, setMenuItems] = useState([])
+
+
+ const [expandedPage, setExpandedPage] = useState('conversation')
+ const conversationExpanded = expandedPage === 'conversation'
+
+ const toggleExpand = (page) => {
+ setExpandedPage(prev => prev === page ? null : page)
+ }
+ const [conversationConversations, setConversationConversations] = useState(conversationStore.getConversations())
+
+ const [collapsed, setCollapsed] = useState(false);
+ const toggleCollapsed = () => setCollapsed(c => !c);
+
+
useEffect(() => {
if (!dynamicRoute || dynamicRoute?.length === 0) return
let newList = []
@@ -102,7 +121,12 @@ const TopNavBar = (props) => {
newList.push({
key: item?.key,
label: item?.label,
- icon: item?.icon
+ icon: item?.icon,
+ children: item?.children?.map(child => ({
+ key: child?.key,
+ label: child?.label,
+ // icon: child?.icon,
+ }))
})
})
@@ -112,6 +136,20 @@ const TopNavBar = (props) => {
setMenuItems(newList)
}, [dynamicRoute])
+
+ useEffect(() => {
+ const unsubscribeConversation = conversationStore.subscribe(({ conversations }) => {
+ setConversationConversations(conversations)
+ })
+
+ return () => {
+ unsubscribeConversation()
+ }
+ }, [])
+
+
+
+
const setRouteActive = value => {
const curKey = value.key
const activeKeys = menuItems?.filter(item => curKey.indexOf(item.key) !== -1)[0]?.key ?? ''
@@ -172,7 +210,6 @@ const TopNavBar = (props) => {
{/*
-