Kaynağa Gözat

fix: 修改对话记录逻辑

hotchicken1996 4 hafta önce
ebeveyn
işleme
77968f3891

+ 10 - 0
client/src/components/PDF/PDFView.vue

@@ -53,6 +53,14 @@ const handlePdfLoaded = (): void => {
     })
   }
 }
+
+const onProcess = (e) => {
+  // console.log('onProcess: ', e)
+}
+
+const onLoaded = (doc: any) => {
+  console.log('onLoaded: ', doc)
+}
 </script>
 
 <template>
@@ -63,6 +71,8 @@ const handlePdfLoaded = (): void => {
     annotation-layer
     text-layer
     :source="url"
+    @progress="onProcess"
+    @loaded="onLoaded"
     @rendered="handlePdfLoaded"
   />
 </template>

+ 9 - 3
client/src/views/OaSystem/aiQA/components/AResult.vue

@@ -3,6 +3,7 @@ import { AResultRecord } from '@/hooks/web/useSSE'
 import PDFLink from '@/views/OaSystem/aiQA/components/PDFLink.vue'
 import ResultMessageView from '@/views/OaSystem/aiQA/components/ResultMessageView.vue'
 import PDFView from '@/components/PDF/PDFView.vue'
+import PdfCanvas from '@/components/PDF/PdfCanvas.vue'
 
 interface AResultProps {
   data: AResultRecord
@@ -78,10 +79,15 @@ const handleClose = (): void => {
       destroy-on-close
     >
       <div class="pdf-view-body">
-        <PDFView
+        <!--        <PDFView-->
+        <!--          v-if="targetViewPdf?.link"-->
+        <!--          :url="targetViewPdf?.link"-->
+        <!--          :highLightContent="targetViewPdf?.content"-->
+        <!--        />-->
+        <PdfCanvas
           v-if="targetViewPdf?.link"
-          :url="targetViewPdf?.link"
-          :highLightContent="targetViewPdf?.content"
+          :src="targetViewPdf?.link"
+          :content="targetViewPdf?.content"
         />
       </div>
       <template #footer></template>

+ 13 - 2
client/src/views/OaSystem/aiQA/components/ChatContent.vue

@@ -90,7 +90,7 @@ const handleClear = (): void => {
   changeQuestion('')
 }
 
-const handleSend = (text): void => {
+const continueChat = (text): void => {
   if ((text ?? '') === '') {
     return
   }
@@ -103,6 +103,17 @@ const handleSend = (text): void => {
   contents[text] = undefined
 }
 
+// 开始对话
+const handleSend = (text: string): void => {
+  if ((currentQuestionId.value ?? '') === '') {
+    // 创建对话
+    changeQuestion(text)
+  } else {
+    // 继续对话
+    continueChat(text)
+  }
+}
+
 /*监控问题变化,开启问答*/
 watch(
   currentQuestion,
@@ -115,7 +126,7 @@ watch(
       })
       currentQuestionId.value = ''
     } else {
-      handleSend(text)
+      continueChat(text)
     }
   },
   { deep: true }