Bladeren bron

通义千问接入信创DS

songxy 2 maanden geleden
bovenliggende
commit
5871421a23

+ 1 - 0
ais_search_zj/web/public/config.js

@@ -35,6 +35,7 @@
     policyServer: 'https://zjugpt.com/server',
     chatServer: '/chat',
     policyChat: '/aisChat',
+    aiServer: '/aiServer',
     knowledgeServer: '/aisChat',
     knowledgeServer2: 'https://natureai.zjugis.com/liqchat',
     knowledgeDocUrl: 'http://127.0.0.1:20331/knowledge_base/download_doc?knowledge_base_name=policy_zzst&file_name=',

+ 7 - 6
ais_search_zj/web/src/views/ai-search/ai-search.vue

@@ -1111,7 +1111,6 @@ const quest = async (isFllow) => {
     1: 10,
     2: 15
   };
-
   let body = null
   if (activeTab.value === 'net') {
     body = {
@@ -1124,7 +1123,7 @@ const quest = async (isFllow) => {
     body = {
       query: question.value,
       mode: 'local_kb',
-      kb_name: activeTab.value === 'paper' ? 'compose_paper_material_total' : window?.AppGlobalConfig?.llm?.kb_name,
+      kb_name: activeTab.value === 'paper' ? 'compose_paper_material_total' : dsChecked.value ? window?.AppGlobalConfig?.llm?.kb_name : 'policy',
       top_k: topKs[answerType.value],
       search_type: answerType.value,
       score_threshold: 0.5,
@@ -1150,8 +1149,8 @@ const quest = async (isFllow) => {
     currentResponse.value.mockStart = true;
     streamToAnswer();
   }
-
-  await fetchEventSource(window.AppGlobalConfig.knowledgeServer + questionUrl, {
+  const rootUrl = dsChecked.value ? window.AppGlobalConfig.knowledgeServer : window.AppGlobalConfig.aiServer
+  await fetchEventSource(rootUrl + questionUrl, {
     method: 'POST',
     openWhenHidden: true,
     timeout: 300000,
@@ -1577,7 +1576,8 @@ for example:
     redirect: 'follow'
   };
 
-  fetch(window.AppGlobalConfig.knowledgeServer + '/chat/chat', requestOptions)
+  const rootUrl = dsChecked.value ? window.AppGlobalConfig.knowledgeServer : window.AppGlobalConfig.aiServer
+  fetch(rootUrl + '/chat/chat', requestOptions)
     .then((response) => {
       return response.json()
     })
@@ -1637,7 +1637,8 @@ const getQuestionKeyWords = async () => {
     redirect: 'follow'
   };
 
-  return fetch(window.AppGlobalConfig.knowledgeServer + '/chat/chat', requestOptions)
+  const rootUrl = dsChecked.value ? window.AppGlobalConfig.knowledgeServer : window.AppGlobalConfig.aiServer
+  return fetch(rootUrl + '/chat/chat', requestOptions)
     .then((response) => response.json())
     .then((msgStr) => {
       const msg = JSON.parse(msgStr)

+ 7 - 0
ais_search_zj/web/vite.config.js

@@ -61,6 +61,13 @@ export default defineConfig({
           changeOrigin: true,
           rewrite: function (path) { return path.replace(/^\/aisChat/, ''); }
       },
+      '/aiServer': {
+        // target: 'http://localhost:9999/',
+          target: 'http://10.249.6.132:8528/aiServer',
+          // target: 'https://zdzy.zrzyt.zj.gov.cn/aisKnowledge',
+          changeOrigin: true,
+          rewrite: function (path) { return path.replace(/^\/aiServer/, ''); }
+      },
       '/auth': {
         // target: 'http://localhost:9999/',
           target: 'https://ai.zrzyt.zj.gov.cn/auth',