Explorar el Código

添加追问模式

songxy hace 2 meses
padre
commit
74351a2744

+ 9 - 4
ais_search_zj/web/src/views/ai-home/index.vue

@@ -440,6 +440,7 @@ const onSendHandle = (status = true) => {
     message.error('请输入问题');
     return;
   }
+  const isFllow = historys.value.length > 0
   if (!status) {
     historys.value[historyIndex].currentResponse.loading = false;
     stopAI();
@@ -462,7 +463,7 @@ const onSendHandle = (status = true) => {
       docs: []
     }
   })
-  ask(decodeURIComponent(cQuestion.value));
+  ask(decodeURIComponent(cQuestion.value), isFllow);
   cQuestion.value = '';
   const timer = setTimeout(() => {
     scrollToBottom()
@@ -535,8 +536,6 @@ const streamToAnswer = () => {
       }
 
       activeIndex.value = 5;
-
-      console.log('mock 结束');
     }
   }, 50);
 };
@@ -639,7 +638,6 @@ let scb = null;
 const quest = async (isFllow) => {
   startTime.value = Date.now();
   window.scroll({ top: 0, behavior: 'smooth' });
-  question.value = (isFllow ? '追问: ' : '') + question.value;
   evaluate.value = null;
   activeIndex.value = 0;
 
@@ -726,6 +724,13 @@ const quest = async (isFllow) => {
   if (activeTab.value === 'knowledge' && isFllow) {
     if (questHistories.value.length > 0) {
       body.history_keyword = questHistories.value[questHistories.value.length - 1].keywords;
+      const arrs = historys.value.map((history) => {
+        return {
+            "role": "user",
+            "content": history.question
+          }
+      })
+      body.history = arrs
     }
   }
   if (activeTab.value !== 'net' && answerType.value !== '0') {

+ 2 - 2
ais_search_zj/web/src/views/zcdb/components/aiAssistant.vue

@@ -42,7 +42,7 @@
                     />
                   </div>
                   <vue-markdown-it
-                    :source="item.isChain === '1' ? item.content : ''"
+                    :source="item.isChain === '1' ? item.content.substring(item.content.indexOf('###')) : ''"
                     :options="{
                       html: true,
                       linkify: true
@@ -208,7 +208,7 @@ const query = async () => {
       },
       onerror(err) {
         form.value.aiLoading = false;
-      status.value = 2
+        status.value = 2
         throw err;
       }
     }

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

@@ -19,8 +19,6 @@
             >
               <img src="/images/zcjd/upload-icon.png" />上传本地文件
             </a-upload>
-
-            <a-button class="ai-btn">AI解读</a-button>
           </div>
           <div class="right" v-if="false">
             <span @click="downloadFile"><img src="/images/zcjd/download-icon.png" />下载</span>
@@ -42,7 +40,6 @@
             <div class="check-type">
               <div class="check">
                 <a-radio-group v-model:value="checkType" button-style="solid">
-                  <a-radio-button value="interpretation">AI解读</a-radio-button>
                   <a-radio-button value="question">AI解读</a-radio-button>
                 </a-radio-group>
               </div>
@@ -175,7 +172,7 @@ const question = [
   '有没有类似的政策文件?',
   '文件中提到了哪些信息化内容?'
 ];
-const checkType = ref('interpretation');
+const checkType = ref('question');
 onMounted(async () => {
   const id = route.query.id;
   const url = route.query.url;
@@ -274,8 +271,8 @@ const handleChange = (info) => {
     chatDesc.value = [];
     loading.value = false;
     content.value = '';
-    checkType.value = 'interpretation';
-    uploadFile();
+    checkType.value = 'question';
+    // uploadFile();
   } else if (status === 'error') {
     message.error(`${info.file.name} file upload failed.`);
   }