Bladeren bron

优化追问时文件预览没法打开

songxy 1 maand geleden
bovenliggende
commit
50e53175bd

+ 1 - 0
ais_search_zj/web/components.d.ts

@@ -14,6 +14,7 @@ declare module 'vue' {
     BasicCurdPage: typeof import('./src/components/curd/BasicCurdPage.vue')['default']
     BasicCurdPageFrame: typeof import('./src/components/curd/frame/BasicCurdPageFrame.vue')['default']
     BasicQueryForm: typeof import('./src/components/query/BasicQueryForm.vue')['default']
+    copy: typeof import('./src/components/pdf/PDFViewerSearch copy.vue')['default']
     HomeCard: typeof import('./src/components/home-card/HomeCard.vue')['default']
     IframePage: typeof import('./src/components/iframe-page/IframePage.vue')['default']
     MarkdownToc: typeof import('./src/components/markdown-toc/MarkdownToc.vue')['default']

+ 0 - 1
ais_search_zj/web/src/components/pdf/PdfCanvas.vue

@@ -78,7 +78,6 @@ const goLocation = (txt) => {
 
   var ptText = text.replaceAll('\n', '');
   ptText = ptText.replaceAll(' ', '');
-  console.log(ptText);
   pageText.value.forEach((item) => {
     item.txt = item.txt.replaceAll('\n', '');
     item.txt = item.txt.replaceAll(' ', '');

+ 0 - 1
ais_search_zj/web/src/components/pdf/WordViewer.vue

@@ -119,7 +119,6 @@ const goSourceLocation = (content) => {
 
   var ptText = text.replaceAll('\n', '');
   ptText = ptText.replaceAll(' ', '');
-  console.log(ptText);
   for (var i = 0; i < pageText.value.length; i++) {
     var item = pageText.value[i];
     item.txt = item.txt.replaceAll('\n', '');

+ 5 - 1
ais_search_zj/web/src/views/ai-home/components/DraggableSplitter.vue

@@ -28,6 +28,8 @@ let startX, startWidth;
 const mouseDownHandle = (e) => {
   isDragging = true;
   startX = e.clientX;
+  console.log("startX----------------------")
+  console.log(startX)
   startWidth = leftPane.value.offsetWidth;
   document.addEventListener('mousemove', onMouseMove);
   document.addEventListener('mouseup', onMouseUp);
@@ -37,7 +39,8 @@ function onMouseMove(e) {
   if (!isDragging) return;
   const delta = e.clientX - startX;
   const newWidth = startWidth - delta;
-  const maxWidth = container.value.offsetWidth * 0.8;
+  const maxWidth = container.value.offsetWidth * 0.6;
+  console.log("maxWidth:"+maxWidth)
   leftPane.value.style.width = Math.min(maxWidth, Math.max(100, newWidth)) + 'px';
 }
 
@@ -62,6 +65,7 @@ function onMouseUp() {
   .right-pane {
     background: #e0e0e0;
     overflow-y: scroll;
+    max-width: 1280px;
   }
 
   .splitter {

+ 15 - 12
ais_search_zj/web/src/views/ai-home/index.vue

@@ -520,7 +520,7 @@ const streamToAnswer = () => {
         const docsNum = historys.value[historyIndex].currentResponse.docs.length;
         historys.value[historyIndex].currentResponse.streamMsg = historys.value[historyIndex].currentResponse.streamMsg.replace(
           `[[${num}]]`,
-          `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
+          `<span onclick="window.openDocByIndex(${num}, ${id}, ${historyIndex})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
     height: 20px;
     background: #FFFFFF;
     border-radius: 4px 4px 4px 4px;
@@ -821,7 +821,7 @@ const handleKnowledgeResponse = (msg, id) => {
         const docsNum = historys.value[historyIndex].currentResponse.docs.length;
         historys.value[historyIndex].currentResponse.msg = historys.value[historyIndex].currentResponse.msg.replace(
           `[[${num}]]`,
-          `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
+          `<span onclick="window.openDocByIndex(${num}, ${id}, ${historyIndex})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
   height: 20px;
   background: #FFFFFF;
   border-radius: 4px 4px 4px 4px;
@@ -847,7 +847,7 @@ const handleKnowledgeResponse = (msg, id) => {
             const docsNum = historys.value[historyIndex].currentResponse.docs.length;
             historys.value[historyIndex].currentResponse.msg = historys.value[historyIndex].currentResponse.msg.replace(
               `[[${num}]]`,
-              `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
+              `<span onclick="window.openDocByIndex(${num}, ${id}, ${historyIndex})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd;    width: 20px;
   height: 20px;
   background: #FFFFFF;
   border-radius: 4px 4px 4px 4px;
@@ -915,7 +915,7 @@ const handleNetResponse = (msg, id) => {
           }
           historys.value[historyIndex].currentResponse.msg = historys.value[historyIndex].currentResponse.msg.replace(
             `[[${num}]]`,
-            `<span onclick="window.openDocByIndex(${num}, ${id})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd">${num}</span>`
+            `<span onclick="window.openDocByIndex(${num}, ${id}, ${historyIndex})" class="poi" style="    cursor: pointer; display: inline-block; width: 20px; height: 20px; font-size: 12px; line-height: 20px; text-align: center; margin: 0 5px; border-radius: 10px;background: #d0d5dd">${num}</span>`
           );
 
           num = getNum(historys.value[historyIndex].currentResponse.msg);
@@ -1010,10 +1010,13 @@ const openUrl = (url) => {
   window.open(url, '_blank');
 };
 
-const openDocByIndex = (ind, id) => {
+const openDocByIndex = (ind, id, hIndex = null) => {
+  if (hIndex === null) {
+    hIndex = historyIndex
+  }
   showDoc.value = false;
   let link = null;
-  if (id !== historys.value[historyIndex].currentResponse.id) {
+  if (id !== historys.value[hIndex].currentResponse.id) {
     if (questHistories.value[id].docs[ind - 1].type === 'url') {
       openUrl(questHistories.value[id].docs[ind - 1].link);
       return;
@@ -1022,14 +1025,14 @@ const openDocByIndex = (ind, id) => {
     link = questHistories.value[id].docs[ind - 1].link;
     fileType.value = questHistories.value[id].docs[ind - 1].type;
   } else {
-    if (historys.value[historyIndex].currentResponse.docs[ind - 1].type === 'url') {
-      openUrl(historys.value[historyIndex].currentResponse.docs[ind - 1].link);
+    if (historys.value[hIndex].currentResponse.docs[ind - 1].type === 'url') {
+      openUrl(historys.value[hIndex].currentResponse.docs[ind - 1].link);
       return;
     }
-    link = historys.value[historyIndex].currentResponse.docs[ind - 1].link;
-    fileType.value = historys.value[historyIndex].currentResponse.docs[ind - 1].type;
-    pdfContent.value = historys.value[historyIndex].currentResponse.docs[ind - 1].content;
-    pdfNum.value = historys.value[historyIndex].currentResponse.docs[ind - 1].num;
+    link = historys.value[hIndex].currentResponse.docs[ind - 1].link;
+    fileType.value = historys.value[hIndex].currentResponse.docs[ind - 1].type;
+    pdfContent.value = historys.value[hIndex].currentResponse.docs[ind - 1].content;
+    pdfNum.value = historys.value[hIndex].currentResponse.docs[ind - 1].num;
   }
   pdfNum.value = ind;
   pdfSrc.value = window.formatDocUrl(link, modelType.value)

+ 0 - 1
ais_search_zj/web/src/views/wwzx/components/PdfEditor.vue

@@ -250,7 +250,6 @@ const goSourceLocation = (content, type) => {
   var text = content;
   var ptText = text.replaceAll("\n", "");
   ptText = ptText.replaceAll(" ", "");
-  console.log(ptText);
   pageText.value.forEach((item) => {
     item.txt = item.txt.replaceAll("\n", "");
     item.txt = item.txt.replaceAll(" ", "");