|
|
@@ -233,7 +233,7 @@ const AppDrawer: React.FC<AppDrawerProps> = (props) => {
|
|
|
const res = await api.get(`/deepseek/api/project/app`);
|
|
|
// 确保 res.data 是数组,如果不是则设为空数组
|
|
|
const data = Array.isArray(res.data) ? res.data : [];
|
|
|
-
|
|
|
+
|
|
|
if (type === 'all') {
|
|
|
setList(data);
|
|
|
} else {
|
|
|
@@ -386,20 +386,8 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
// 获取聊天列表
|
|
|
const fetchChatList = async (chatMode?: 'ONLINE' | 'LOCAL') => {
|
|
|
try {
|
|
|
- let url = '';
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- const appId = globalStore.selectedAppId;
|
|
|
- if (appId) {
|
|
|
- if (chatMode === 'LOCAL') {
|
|
|
- url = `/deepseek/api/dialog/list/${appId}`;
|
|
|
- } else {
|
|
|
- url = `/bigmodel/api/dialog/list/${appId}`;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- const appId = '1881269958412521255';
|
|
|
- url = `/bigmodel/api/dialog/list/${appId}`;
|
|
|
- }
|
|
|
+ const appId = '2924812721300312064';
|
|
|
+ const url = `/deepseek/api/dialog/list/${appId}`;
|
|
|
const res = await api.get(url);
|
|
|
const list = res.data.map((item: any) => {
|
|
|
return {
|
|
|
@@ -426,15 +414,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
<a onClick={async () => {
|
|
|
try {
|
|
|
let blob = null;
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- if (chatMode === 'LOCAL') {
|
|
|
- blob = await api.post(`/deepseek/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
|
|
|
- } else {
|
|
|
- blob = await api.post(`/bigmodel/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
|
|
|
- }
|
|
|
- } else {
|
|
|
- blob = await api.post(`/bigmodel/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
|
|
|
- }
|
|
|
+ blob = await api.post(`/deepseek/api/dialog/export/${child.key}`, {}, { responseType: 'blob' });
|
|
|
const fileName = `${child.label}.xlsx`;
|
|
|
downloadFile(blob, fileName);
|
|
|
} catch (error) {
|
|
|
@@ -450,18 +430,8 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
label: (
|
|
|
<a onClick={async () => {
|
|
|
try {
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- if (chatMode === 'LOCAL') {
|
|
|
- await api.delete(`/deepseek/api/dialog/del/${child.key}`);
|
|
|
- await fetchChatList(chatMode);
|
|
|
- } else {
|
|
|
- await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
|
|
|
- await fetchChatList();
|
|
|
- }
|
|
|
- } else {
|
|
|
- await api.delete(`/bigmodel/api/dialog/del/${child.key}`);
|
|
|
- await fetchChatList();
|
|
|
- }
|
|
|
+ await api.delete(`/deepseek/api/dialog/del/${child.key}`);
|
|
|
+ await fetchChatList(chatMode);
|
|
|
chatStore.clearSessions();
|
|
|
useChatStore.setState({
|
|
|
message: {
|
|
|
@@ -570,6 +540,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
onClick={() => {
|
|
|
navigate({ pathname: '/' });
|
|
|
}}
|
|
|
+ disabled
|
|
|
>
|
|
|
回到首页
|
|
|
</Button>
|
|
|
@@ -580,14 +551,12 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
chatStore.updateCurrentSession((value) => {
|
|
|
value.appId = globalStore.selectedAppId;
|
|
|
});
|
|
|
+ globalStore.setIsChatActive(false);
|
|
|
+ globalStore.setDocuments([]);
|
|
|
if (isMobileScreen) {
|
|
|
globalStore.setShowMenu(false);
|
|
|
}
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- navigate({ pathname: '/newChat' });
|
|
|
- } else {
|
|
|
- navigate({ pathname: '/newDeepseekChat' });
|
|
|
- }
|
|
|
+ navigate({ pathname: '/newDeepseekChat' });
|
|
|
if (getType() === 'bigModel') {
|
|
|
if (chatStore.chatMode === 'LOCAL') {
|
|
|
await fetchChatList(chatStore.chatMode);
|
|
|
@@ -602,28 +571,6 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
新建对话
|
|
|
</Button>
|
|
|
</div>
|
|
|
- <div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 10 }}>
|
|
|
- <Button
|
|
|
- style={{ width: '48%' }}
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
- setDrawerType('all');
|
|
|
- setDrawerOpen(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 我的应用
|
|
|
- </Button>
|
|
|
- <Button
|
|
|
- style={{ width: '48%' }}
|
|
|
- type="primary"
|
|
|
- onClick={() => {
|
|
|
- setDrawerType('collect');
|
|
|
- setDrawerOpen(true);
|
|
|
- }}
|
|
|
- >
|
|
|
- 我的收藏
|
|
|
- </Button>
|
|
|
- </div>
|
|
|
</SideBarHeader>
|
|
|
<Menu
|
|
|
style={{ border: 'none' }}
|
|
|
@@ -636,15 +583,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
globalStore.setShowMenu(false);
|
|
|
}
|
|
|
let url = ``;
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- if (chatStore.chatMode === 'LOCAL') {
|
|
|
- url = `/deepseek/api/dialog/detail/${key}`;
|
|
|
- } else {
|
|
|
- url = `/bigmodel/api/dialog/detail/${key}`;
|
|
|
- }
|
|
|
- } else {
|
|
|
- url = `/bigmodel/api/dialog/detail/${key}`;
|
|
|
- }
|
|
|
+ url = `/deepseek/api/dialog/detail/${key}`;
|
|
|
const res = await api.get(url);
|
|
|
const list = res.data.map(((item: any) => {
|
|
|
return {
|
|
|
@@ -652,9 +591,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
role: item.type,
|
|
|
date: item.create_time,
|
|
|
content: item.content,
|
|
|
- document: item.document ? item.document : undefined,
|
|
|
- sliceInfo: item.sliceInfo ? item.sliceInfo : undefined,
|
|
|
- networkInfo: item.networkInfo ? item.networkInfo : undefined,
|
|
|
+ documents: item.documents ? item.documents : undefined,
|
|
|
}
|
|
|
}))
|
|
|
const session = {
|
|
|
@@ -663,6 +600,8 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
id: res.data.length ? res.data[0].id : '',
|
|
|
messages: list,
|
|
|
}
|
|
|
+ globalStore.setIsChatActive(true);
|
|
|
+ globalStore.setDocuments([]);
|
|
|
globalStore.setCurrentSession(session);
|
|
|
chatStore.clearSessions();
|
|
|
chatStore.updateCurrentSession((value) => {
|
|
|
@@ -671,17 +610,7 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
value.id = session.id;
|
|
|
value.messages = list;
|
|
|
});
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- const search = `?showMenu=${showMenu}&chatMode=${chatMode}&appId=${appId}`;
|
|
|
- if (appId) {
|
|
|
- navigate({
|
|
|
- pathname: '/knowledgeChat',
|
|
|
- search: search,
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- navigate({ pathname: '/newDeepseekChat' });
|
|
|
- }
|
|
|
+ navigate({ pathname: '/newDeepseekChat' });
|
|
|
}}
|
|
|
mode="inline"
|
|
|
items={menuList}
|
|
|
@@ -695,27 +624,11 @@ export const SideBar = (props: { className?: string }) => {
|
|
|
form.validateFields().then(async (values) => {
|
|
|
setModalOpen(false);
|
|
|
try {
|
|
|
- if (getType() === 'bigModel') {
|
|
|
- if (chatStore.chatMode === 'LOCAL') {
|
|
|
- await api.put(`/deepseek/api/dialog/update`, {
|
|
|
- id: values.dialogId,
|
|
|
- dialogName: values.dialogName
|
|
|
- });
|
|
|
- await fetchChatList(chatStore.chatMode);
|
|
|
- } else {
|
|
|
- await api.put(`/bigmodel/api/dialog/update`, {
|
|
|
- id: values.dialogId,
|
|
|
- dialogName: values.dialogName
|
|
|
- });
|
|
|
- await fetchChatList();
|
|
|
- }
|
|
|
- } else {
|
|
|
- await api.put(`/bigmodel/api/dialog/update`, {
|
|
|
- id: values.dialogId,
|
|
|
- dialogName: values.dialogName
|
|
|
- });
|
|
|
- await fetchChatList();
|
|
|
- }
|
|
|
+ await api.put(`/deepseek/api/dialog/update`, {
|
|
|
+ id: values.dialogId,
|
|
|
+ dialogName: values.dialogName
|
|
|
+ });
|
|
|
+ await fetchChatList(chatStore.chatMode);
|
|
|
chatStore.updateCurrentSession((value) => {
|
|
|
value.topic = values.dialogName;
|
|
|
});
|