Ver código fonte

政策对比和政策解读功能集成

songxy 3 meses atrás
pai
commit
ae2332c408

+ 5 - 3
ais_search_zj/web/public/config.js

@@ -4,6 +4,7 @@
       name: '省域空间治理数字化平台',
       copyright: '版权所有© 2024 浙江万维空间信息技术有限公司',
     },
+    isDisabledSource: true,
     authorization: {
       enabled: false,
       time: 12
@@ -33,11 +34,12 @@
     authServer: '/auth',
     policyServer: 'https://zjugpt.com/server',
     chatServer: '/chat',
+    policyChat: '/aisChat',
     knowledgeServer: '/aisChat',
     knowledgeServer2: 'https://natureai.zjugis.com/liqchat',
-    knowledgeDocUrl: 'http://127.0.0.1:20331/knowledge_base/download_doc?knowledge_base_name=policy&file_name=',
-    knowledgeDocUrlProxy: 'https://zdzy.zrzyt.zj.gov.cn/aiServer/knowledge_base/download_doc?knowledge_base_name=policy&file_name=',
-    knowledgeDocUrlProxy2: 'https://zdzy.zrzyt.zj.gov.cn/aiServer/knowledge_base/download_doc/policy/',
+    knowledgeDocUrl: 'http://127.0.0.1:20331/knowledge_base/download_doc?knowledge_base_name=policy_zzst&file_name=',
+    knowledgeDocUrlProxy: 'https://ai.zrzyt.zj.gov.cn/aisChat/knowledge_base/download_doc?knowledge_base_name=policy_zzst&file_name=',
+    knowledgeDocUrlProxy2: 'https://ai.zrzyt.zj.gov.cn/aisChat/knowledge_base/download_doc/policy_zzst/',
     landMarketUrl: 'https://natureai.zjugis.com/subscribe/',
     // 外链
     links: {

+ 1 - 1
ais_search_zj/web/src/components/pdf/PDFViewerSearch.vue

@@ -175,7 +175,7 @@ const onLoad = () => {
 };
 const src = computed(() => {
   // return `/lib/pdfjs/web/viewer.html?file=${props.src}&t=` + new Date().getTime();
-  return `/lib/pdfjs/web/viewer.html?file=${props.src}&t=` + new Date().getTime();
+  return `/aisearch/lib/pdfjs/web/viewer.html?file=${props.src}&t=` + new Date().getTime();
 
   // return `/lib/pdfjs/web/viewer.html?file=http://121.40.148.47:8530/doc/knowledge_base/download_doc/国土资源部 国家发展和改革委员会+财政部+住房和城乡建设部农业部+中国人民银行+国家林业局+中国银行业监督管理委员会关于扩大国有土地有偿使用范围的意见%28279-283%29.pdf`
 });

+ 1 - 1
ais_search_zj/web/src/views/ai-search/ai-search.vue

@@ -1434,6 +1434,7 @@ const handleDocs = (docs) => {
 };
 
 const openDoc = (doc, i) => {
+  if (window.AppGlobalConfig.isDisabledSource) return;
   var link = doc.link;
   var type = doc.type;
   pdfSrc.value = link.replace(
@@ -1631,7 +1632,6 @@ const getQuestionKeyWords = async () => {
       const str = msg.choices[0]?.message?.content;
       if (str) {
         const str1 = str.slice(str.indexOf("</think>")+7)
-        console.log(str1)
         const keywords = splitWords(str1).slice(0, 3);
         setActiveIndexTags(0, keywords);
         currentResponse.value.keywords = keywords;

+ 1 - 1
ais_search_zj/web/src/views/home/home.vue

@@ -54,7 +54,7 @@
           </div>
         </div>
       </div>
-      <div class="ai_tool_box" v-if="false">
+      <div class="ai_tool_box">
         <h4>AI工具</h4>
         <ul>
           <li @click="toToolPage('./#/policy/interpret')">

+ 8 - 5
ais_search_zj/web/src/views/home/index.vue

@@ -7,10 +7,12 @@
       <div class="container">
         <div class="tool">
           <ul>
-            <li v-for="(menu,index) in menuRoutes" :key="index" :class="{active: cMenuRoute['title'] === menu['title']}" @click="toSwitchPage(menu)">
-              <span :class="`iconfont ${menu['icon']}`"></span>
-              <span class="title">{{menu['title']}}</span>
-            </li>
+            <template v-for="(menu,index) in menuRoutes" :key="index">
+              <li  v-if="index < 3" :class="{active: cMenuRoute['title'] === menu['title']}" @click="toSwitchPage(menu)">
+                <span :class="`iconfont ${menu['icon']}`"></span>
+                <span class="title">{{menu['title']}}</span>
+              </li>
+            </template>
           </ul>
         </div>
         <div class="top-content">
@@ -41,7 +43,8 @@ const menuRoutes = [
     icon: 'icon-a-lujing11029',
     name: 'Znxz',
     iframe: true
-  },{
+  },
+  {
     title: '知识库',
     icon: 'icon-66zhishikuguanli',
     name: 'Document',

+ 9 - 1
ais_search_zj/web/src/views/wwzx/newDocument.vue

@@ -685,6 +685,10 @@ const queryArticle = async (
               contentDesc.value = contentDesc.value.replaceAll(title3, title2);
             }
           }
+          
+          if (contentDesc.value.indexOf("</think>") !== -1) {
+            contentDesc.value = contentDesc.value.slice(contentDesc.value.indexOf("</think>")+8)
+          }
           if (!item) {
             contentDesc.value = contentDesc.value.replaceAll(title2, "");
             contentDesc.value = contentDesc.value.replaceAll(title5, "");
@@ -1086,7 +1090,7 @@ const chapterRefrash = async (
             `---${ctitle}---`,
             `**${ctitle}**`
           );
-
+          console.log("1111111---------------------")
           if (!need) {
             if (
               contentDesc.value.length > ctitle.length + 4 &&
@@ -1232,6 +1236,10 @@ const queryThirdArticle = async (
           contentDesc.value += rData.choices[0].delta.content
             ? rData.choices[0].delta.content
             : "";
+            console.log("2222222222222")
+          if (contentDesc.value.indexOf("</think>") !== -1) {
+            contentDesc.value = contentDesc.value.slice(contentDesc.value.indexOf("</think>")+8)
+          }
           if (citem) {
             contentDesc.value = contentDesc.value.replaceAll(
               `---${citem.title}---`,

+ 5 - 0
ais_search_zj/web/src/views/wwzx/xjwd/generateOutline.vue

@@ -1725,6 +1725,11 @@ const chunkArray = (array, chunkSize) => {
 };
 const handleData = () => {
   if (content.value) {
+    console.log("content.value--------------------------")
+    console.log(content.value)
+    if (content.value.indexOf("</think>") !== -1) {
+      content.value = content.value.slice(content.value.indexOf("</think>")+8)
+    }
     content.value = content.value.replaceAll("\\n", "\n");
     content.value = content.value
       .replaceAll("\n\n", "\n")

+ 1 - 1
ais_search_zj/web/src/views/wwzx/xjwd/inputInformation.vue

@@ -211,7 +211,7 @@
         </div>
       </div>
     </div>
-    <div class="tab-box">
+    <div class="tab-box" v-if="false">
       <div
         class="item"
         v-for="(item, index) in tabs"

+ 48 - 52
ais_search_zj/web/src/views/zcdb/smartComparison.vue

@@ -4,7 +4,7 @@
       <home-header sub-title="自然资源大模型工具" />
     </div>
     <div class="content-box">
-      <div class="top">
+      <div class="top" v-if="false">
         <div
           v-for="(item, index) in fileList"
           :key="item"
@@ -27,7 +27,7 @@
               <a-upload
                 v-if="fileList1.length === 0"
                 class="upload"
-                action="https://zjugpt.com/knowledge/policy/file/upload"
+                action="/aisKnowledge/infra/file/upload"
                 @change="(info)=>handleChange(info, 1)"
                 :showUploadList="false"
                 :data="{ type: 'temp' }"
@@ -38,8 +38,8 @@
               </a-upload>
               <div v-else class="preview">
                 <span class="icon"><img src="../../assets/images/pdf_icon.png" /></span>
-                <div>
-                  <span class="title">{{ fileList1[0]['name'] }}</span>
+                <div @click="switchPdfSource(1)">
+                  <span class="title">{{ fileList1[0]['fileName'] }}</span>
                   <span class="size">{{ (fileList1[0]['size'] / 1024).toFixed(2) }}KB</span>
                 </div>
                 <span class="close" @click="deleteFileHandle(1)">x</span>
@@ -50,7 +50,7 @@
               <a-upload
                 v-if="fileList2.length === 0"
                 class="upload"
-                action="https://zjugpt.com/knowledge/policy/file/upload"
+                action="/aisKnowledge/infra/file/upload"
                 @change="(info)=>handleChange(info, 2)"
                 :showUploadList="false"
                 :data="{ type: 'temp' }"
@@ -61,8 +61,8 @@
               </a-upload>
               <div v-else class="preview">
                 <span class="icon"><img src="../../assets/images/pdf_icon.png" /></span>
-                <div>
-                  <span class="title">{{ fileList2[0]['name'] }}</span>
+                <div @click="switchPdfSource(2)">
+                  <span class="title">{{ fileList2[0]['fileName'] }}</span>
                   <span class="size">{{ (fileList2[0]['size'] / 1024).toFixed(2) }}KB</span>
                 </div>
                 <span class="close" @click="deleteFileHandle(2)">x</span>
@@ -92,11 +92,7 @@ import { message } from 'ant-design-vue';
 import { CloseCircleOutlined } from '@ant-design/icons-vue';
 import PDFViewer from '@/components/pdf/PDFViewerSearch.vue';
 import AiAssistant from './components/aiAssistant.vue';
-const fileList = ref([
-  '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见',
-  '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见',
-  '国家邮政局关于支持广西打造面向东盟的区域性国际邮政快递枢纽的意见'
-]);
+const fileList = ref([]);
 import api from '@/utils/policy-api';
 import { useUserStore } from '@/stores/user/user';
 import PubsubService from '@/utils/PubsubService';
@@ -125,30 +121,23 @@ onMounted(() => {
     zoomFlag.value = t.value;
   });
   index.value=-1;
-  fileList.value = user.files;
-  if (fileList.value && fileList.value.length > 0) {
-    current.value = fileList.value[0];
-    current.value.url = '';
-    queryFilesName();
-  }
 });
 const fileList1 = ref([])
 const fileList2 = ref([])
 const handleChange = (info, type) => {
   var name = info.file.name.split('.')[0];
   var fileName = info.file.name;
-  var url = '/knowledge/file/temp/' + fileName;
   const status = info.file.status;
-  if (status !== 'uploading') {
-    console.log(info.file, info.fileList);
-  }
   if (status === 'done') {
     message.success(`${info.file.name} 文件上传成功.`);
     const id = 'title-' + new Date().getTime();
+    const url = 'https://ai.zrzyt.zj.gov.cn/aisKnowledge' + info.file.response.data;
     var item = {
       id: id,
       f_title: name,
       f_type: 'temp',
+      size: info.file.size,
+      fileName: fileName,
       url: url
     };
     if (type === 1) {
@@ -157,17 +146,43 @@ const handleChange = (info, type) => {
     if (type === 2) {
       fileList2.value = [item]
     }
+    fileList.value.push(item)
+    if (fileList.value.length > 1) {
+      current.value = fileList.value[0];
+      queryFilesName();
+    }
   } else if (status === 'error') {
     message.error(`${info.file.name} file upload failed.`);
   }
 };
+const switchPdfSource = (type) => {
+  if (type === 1) {
+    current.value = fileList1.value[0];
+  }else if (type === 2) {
+    current.value = fileList2.value[0];    
+  }
+}
 const deleteFileHandle = (type) => {
-    if (type === 1) {
-      fileList1.value = []
-    }
-    if (type === 2) {
-      fileList2.value = []
+  let file = null;
+  if (type === 1) {
+    file = fileList1.value[0]
+    fileList1.value = []
+  }
+  if (type === 2) {
+    file = fileList2.value[0]
+    fileList2.value = []
+  }
+  for (let i = 0; i < fileList.value.length; i++){
+    if(fileList.value[i]['id'] === file['id']) {
+      fileList.value.splice(i, 1);
+      break;
     }
+  }
+  if (fileList.value.length > 0) {
+    current.value = fileList.value[0]
+  } else if (fileList.value.length === 0) { 
+    current.value = {}
+  }
 }
 const queryFilesName = () => {
   if (index.value < fileList.value.length) {
@@ -177,23 +192,8 @@ const queryFilesName = () => {
 };
 const getFileName = () => {
   var item = fileList.value[index.value];
-  var url = '/knowledge/file/name';
-  var p = { id: item.pid };
-  api.get(url, p, this, false).then(async (res) => {
-    var citem = res.data.data;
-    item.fileName = citem.fileName.indexOf('pdf') == -1 ? citem.fileName + '.pdf' : citem.fileName;
-    var url = '/knowledge/file/' + item.fileName;
-    if(citem.filePath&&citem.filePath.startsWith('http')){
-      url =citem.filePath;
-      url = url.replaceAll(window.AppGlobalConfig.fileServer,window.AppGlobalConfig.onlineFileServer);
-    }
-    item.url = url;
-    if (index.value == 0) {
-      current.value.url = url;
-    }
-    initFileByUrl(item);
-    queryFilesName();
-  });
+  initFileByUrl(item);
+  queryFilesName();
 };
 const initFileByUrl = async (item) => {
   var fileName = item.fileName;
@@ -257,14 +257,6 @@ const fetchPdfFileStream = (pdfUrl, name) => {
 const handleMouseLeave = () => {
   hoveredIndex.value = null;
 };
-
-// 返回全部政策页面
-const returnHome = () => {
-  window.open(`/#/final/compare`, '_blank');
-};
-const toggleFile = (item) => {
-  current.value = item;
-};
 </script>
 <style scoped lang="scss">
 .smart-comparison {
@@ -328,6 +320,7 @@ const toggleFile = (item) => {
       width: 1280px;
       height: auto;
       display: flex;
+      margin-top: 20px;
       margin-bottom: 20px;
       .left {
         flex: 1;
@@ -335,6 +328,7 @@ const toggleFile = (item) => {
         background: #ffffff;
         box-shadow: 0px 1px 8px 0px #e4e4e4;
         border-radius: 10px;
+        max-width: 940px;
         >.upload-box {
           display: flex;
           align-items: center;
@@ -358,6 +352,7 @@ const toggleFile = (item) => {
             flex: 1;
             text-align: center;
             height: 82px;
+            width: calc(50% - 50px);
             >.upload {
               cursor: pointer;
             }
@@ -365,6 +360,7 @@ const toggleFile = (item) => {
               text-align: left;
               padding: 15px;
               position: relative;
+              cursor: pointer;
               >.icon {
                 width: 50px;
                 height: 50px;

+ 6 - 6
ais_search_zj/web/src/views/zjjd/index.vue

@@ -10,7 +10,7 @@
             <a-input :value="fileDetail?.name" style="width: 400px; margin-right: 10px" />
             <a-upload
               class="upload"
-              action="/knowledge/policy/file/upload"
+              action="/aisKnowledge/infra/file/upload"
               @change="handleChange"
               :showUploadList="false"
               :data="{ type: 'temp' }"
@@ -21,7 +21,7 @@
 
             <a-button class="ai-btn">AI解读</a-button>
           </div>
-          <div class="right">
+          <div class="right" v-if="false">
             <span @click="downloadFile"><img src="/images/zcjd/download-icon.png" />下载</span>
             <span><img src="/images/zcjd/star-icon.png" />收藏</span>
           </div>
@@ -250,11 +250,11 @@ const handleChange = (info) => {
   loading.value = true;
   fileDetail.value = null;
   const status = info.file.status;
-  console.log('==status' + status);
+  console.log("info------------------")
+  console.log(info)
   if (status === 'done') {
-    var fileName = info.file.name;
     fileDetail.value = info.file.originFileObj;
-    fileUrl.value = '/knowledge/file/temp/' + fileName;
+    fileUrl.value = 'https://ai.zrzyt.zj.gov.cn/aisKnowledge' + info.file.response.data;
     chatDesc.value = [];
     loading.value = false;
     content.value = '';
@@ -361,7 +361,7 @@ const query = async () => {
   params.append('files', fileDetail.value);
   params.append('stream', true);
   params.append('query', queryText.value);
-  await fetchEventSource(window.AppGlobalConfig.knowledgeServer2 + '/chat/complete_file_chat', {
+  await fetchEventSource(window.AppGlobalConfig.policyChat + '/chat/complete_file_chat', {
     method: 'POST',
     openWhenHidden: true,
     body: params,

+ 15 - 8
ais_search_zj/web/vite.config.js

@@ -42,14 +42,21 @@ export default defineConfig({
     proxy: {
       '/server': {
         // target: 'http://localhost:9999/',
-          target: 'https://ai.zrzyt.zj.gov.cn/aisKnowledge',
+          target: 'http://10.249.6.132:8528/aisKnowledge',
           // target: 'https://zdzy.zrzyt.zj.gov.cn/aisKnowledge',
           changeOrigin: true,
           rewrite: function (path) { return path.replace(/^\/server/, ''); }
       },
+      '/aisKnowledge': {
+        // target: 'http://localhost:9999/',
+          target: 'http://10.249.6.132:8528/aisKnowledge',
+          // target: 'https://zdzy.zrzyt.zj.gov.cn/aisKnowledge',
+          changeOrigin: true,
+          rewrite: function (path) { return path.replace(/^\/aisKnowledge/, ''); }
+      },
       '/aisChat': {
         // target: 'http://localhost:9999/',
-          target: 'https://ai.zrzyt.zj.gov.cn/aisChat',
+          target: 'http://10.249.6.132:8528/aisChat',
           // target: 'https://zdzy.zrzyt.zj.gov.cn/aisKnowledge',
           changeOrigin: true,
           rewrite: function (path) { return path.replace(/^\/aisChat/, ''); }
@@ -61,16 +68,16 @@ export default defineConfig({
           changeOrigin: true,
           rewrite: function (path) { return path.replace(/^\/auth/, ''); }
       },
-      // '/server': {
-      //   target: 'http://localhost:7501',
-      //   changeOrigin: true,
-      //   rewrite: (path) => path.replace(/^\/server/, '')
-      // },
       '/chat': {
-        target: 'https://zdzy.zrzyt.zj.gov.cn/aiServer/chat',
+        target: 'https://ai.zrzyt.zj.gov.cn/chat',
         changeOrigin: true,
         rewrite: (path) => path.replace(/^\/chat/, '')
       },
+      '/policyChat': {
+        target: 'https://ai.zrzyt.zj.gov.cn/policyChat',
+        changeOrigin: true,
+        rewrite: (path) => path.replace(/^\/policyChat/, '')
+      },
       '/lianqiai2': {
         target: 'http://121.40.148.47:8530',
         changeOrigin: true,