浏览代码

冲突解决

S0025136190 6 月之前
父节点
当前提交
68261e6129
共有 1 个文件被更改,包括 24 次插入7 次删除
  1. 24 7
      app/components/chat.tsx

+ 24 - 7
app/components/chat.tsx

@@ -1017,11 +1017,12 @@ function _Chat() {
   const [selectedFruit, setSelectedFruit] = React.useState(chatStore.chatMode);
 
   // 获取应用列表
-  const fetchApplicationList = async () => {
+  const fetchApplicationList = async (chatMode?: string) => {
+    let mode = chatMode || selectedFruit;
     setLoading(true);
     try {
       let url = null;
-      if (selectedFruit === 'LOCAL') {
+      if (mode === 'LOCAL') {
         url = '/deepseek/api/application/list';
       } else {
         url = '/bigmodel/api/application/list';
@@ -1068,8 +1069,8 @@ function _Chat() {
     }
   }
 
-  const init = async () => {
-    await fetchApplicationList();
+  const init = async (chatMode?: string) => {
+    await fetchApplicationList(chatMode);
   }
 
   useEffect(() => {
@@ -1096,7 +1097,7 @@ function _Chat() {
           session.appId = appId;
         });
       }
-      init();
+      init(chatMode);
     }
   }, [])
 
@@ -1600,7 +1601,15 @@ function _Chat() {
   }
 
   const getAppName = () => {
-    const appId = globalStore.selectedAppId;
+    const search = location.search;
+    const params = new URLSearchParams(search);
+    const chatMode = params.get('chatMode');
+    let appId = '';
+    if (chatMode) {
+      appId = globalStore.selectedAppId;
+    } else {
+      appId = appValue as string;
+    }
     const item = appList.find(item => item.value === appId);
     if (!item) {
       return '';
@@ -1609,7 +1618,15 @@ function _Chat() {
   }
 
   const getDesc = () => {
-    const appId = globalStore.selectedAppId;
+    const search = location.search;
+    const params = new URLSearchParams(search);
+    const chatMode = params.get('chatMode');
+    let appId = '';
+    if (chatMode) {
+      appId = globalStore.selectedAppId;
+    } else {
+      appId = appValue as string;
+    }
     const item = appList.find(item => item.value === appId);
     if (!item) {
       return '';