|
|
@@ -205,7 +205,6 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
const [menuList, setMenuList] = useState([])
|
|
|
const [modalOpen, setModalOpen] = useState(false)
|
|
|
const [form] = Form.useForm();
|
|
|
-
|
|
|
const getType = (): 'bigModel' | 'deepSeek' => {
|
|
|
if (['/knowledgeChat', '/newChat'].includes(location.pathname)) {
|
|
|
return 'bigModel';
|
|
|
@@ -217,7 +216,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
}
|
|
|
|
|
|
// 获取聊天列表
|
|
|
- const fetchChatList = async () => {
|
|
|
+ const fetchChatList = async (deepSeekStatus?:'ONLINE' | 'LOCAL') => {
|
|
|
try {
|
|
|
let appId = '';
|
|
|
if (getType() === 'bigModel') {
|
|
|
@@ -225,7 +224,16 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
} else {
|
|
|
appId = '1881269958412521255';
|
|
|
}
|
|
|
- const res = await api.get(`/bigmodel/api/dialog/list/${appId}`);
|
|
|
+
|
|
|
+ let url = '';
|
|
|
+ if (deepSeekStatus) {
|
|
|
+ if (deepSeekStatus==='LOCAL') {
|
|
|
+ url = `/bigmodel/api/dialog/list/${appId}`;
|
|
|
+ }else{
|
|
|
+ url = `/takai/api/dialog/list/${appId}`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = await api.get(url);
|
|
|
const list = res.data.map((item: any) => {
|
|
|
return {
|
|
|
...item,
|
|
|
@@ -266,8 +274,13 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
label: (
|
|
|
<a onClick={async () => {
|
|
|
try {
|
|
|
- await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
|
|
|
- await fetchChatList()
|
|
|
+ if(deepSeekStatus === 'LOCAL'){
|
|
|
+ await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
|
|
|
+ await fetchChatList();
|
|
|
+ }else{
|
|
|
+ await api.delete(`/takai/api/dialog/del/${child.key}`);
|
|
|
+ await fetchChatList(deepSeekStatus);
|
|
|
+ }
|
|
|
chatStore.clearSessions();
|
|
|
useChatStore.setState({
|
|
|
message: {
|
|
|
@@ -320,6 +333,10 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
});
|
|
|
}, []);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ fetchChatList(chatStore.deepSeekStatus);
|
|
|
+ }, [chatStore.deepSeekStatus]);
|
|
|
+
|
|
|
return (
|
|
|
<SideBarContainer
|
|
|
onDragStart={onDragStart}
|
|
|
@@ -358,7 +375,11 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
} else {
|
|
|
navigate({ pathname: '/newDeepseekChat' });
|
|
|
}
|
|
|
- await fetchChatList()
|
|
|
+ if(chatStore.deepSeekStatus === 'LOCAL'){
|
|
|
+ await fetchChatList();
|
|
|
+ }else{
|
|
|
+ await fetchChatList(chatStore.deepSeekStatus);
|
|
|
+ }
|
|
|
}}
|
|
|
>
|
|
|
新建对话
|
|
|
@@ -368,7 +389,13 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
<Menu
|
|
|
style={{ border: 'none' }}
|
|
|
onClick={async ({ key }) => {
|
|
|
- const res = await api.get(`/bigmodel/api/dialog/detail/${key}`);
|
|
|
+ let url = ``;
|
|
|
+ if(chatStore.deepSeekStatus === 'LOCAL'){
|
|
|
+ url = `/bigmodel/api/dialog/detail/${key}`;
|
|
|
+ }else{
|
|
|
+ url = `/takai/api/dialog/detail/${key}`;
|
|
|
+ }
|
|
|
+ const res = await api.get(url);
|
|
|
const list = res.data.map(((item: any) => {
|
|
|
return {
|
|
|
content: item.content,
|
|
|
@@ -409,11 +436,19 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
form.validateFields().then(async (values) => {
|
|
|
setModalOpen(false);
|
|
|
try {
|
|
|
- await api.put('/bigmodel/api/dialog/update', {
|
|
|
- id: values.dialogId,
|
|
|
- dialogName: values.dialogName
|
|
|
- });
|
|
|
- await fetchChatList()
|
|
|
+ if(chatStore.deepSeekStatus === 'LOCAL'){
|
|
|
+ await api.put(`/bigmodel/api/dialog/update`, {
|
|
|
+ id: values.dialogId,
|
|
|
+ dialogName: values.dialogName
|
|
|
+ });
|
|
|
+ await fetchChatList();
|
|
|
+ }else{
|
|
|
+ await api.put(`/takai/api/dialog/update`, {
|
|
|
+ id: values.dialogId,
|
|
|
+ dialogName: values.dialogName
|
|
|
+ });
|
|
|
+ await fetchChatList(chatStore.deepSeekStatus);
|
|
|
+ }
|
|
|
chatStore.updateCurrentSession((value) => {
|
|
|
value.topic = values.dialogName;
|
|
|
});
|