Эх сурвалжийг харах

fix: 修复历史记录相关接口调整后,引用内容显示异常的问题

zhupei 1 жил өмнө
parent
commit
aa3b6e6775

+ 1 - 1
public/config.js

@@ -34,7 +34,7 @@ window.DIFY_BASE_URL = 'http://smartai.com:8295';
  * http://192.168.20.119:11080/v1/document/image/e2ade7feaae211ef88b50242ac130006-d66a28e5d91eea31e32d6e42474834cd
  * http://192.168.20.119:11080/v1/document/get/041cc868aaef11efa2170242ac130006
  */
-window.REFFERENCE_ASSETS_FILE_URL = 'http://192.168.20.119:11080';
+window.REFFERENCE_ASSETS_FILE_URL = 'http://192.168.20.116:11080';
 
 /**
  * 文档出卷 -> 出卷 -> iframe弹窗地址

+ 3 - 3
src/modules/answer-refference/RefferenceDocDetail.vue

@@ -37,7 +37,7 @@
               @click.stop="handlerClickFragment(frag)"
             >
               <span>{{ index + 1 }}.</span>
-              {{ frag.content_with_weight }}
+              {{ frag.content }}
             </div>
           </div>
         </div>
@@ -129,8 +129,8 @@ const docData = props.targetDocument;
 list.value = docData.doc_aggs.map((item) => {
   return {
     ...item,
-    fragments: docData.chunks.filter((chunk) => chunk.docnm_kwd === item.doc_name),
-    desc: docData.chunks.filter((chunk) => chunk.docnm_kwd === item.doc_name)[0]?.content_ltks
+    fragments: docData.chunks.filter((chunk) => chunk.document_name === item.doc_name),
+    desc: docData.chunks.filter((chunk) => chunk.document_name === item.doc_name)[0]?.content
   };
 });
 

+ 2 - 2
src/modules/answer-refference/RefferenceFileBlocks.vue

@@ -73,10 +73,10 @@ const document_list = computed(() => {
       const cur_doc_peaces = [];
       if (chunks && Array.isArray(chunks)) {
         chunks.forEach((item, index) => {
-          const chunk_doc_id = item.doc_id;
+          const chunk_doc_id = item.document_id;
 
           if (cur_doc_id === chunk_doc_id) {
-            cur_doc_peaces.push(item.content_ltks);
+            cur_doc_peaces.push(item.content);
           }
         });
       }

+ 5 - 5
src/modules/answer-refference/apply-refference-popover-4-ref-flag.js

@@ -37,12 +37,12 @@ export default function applyRefferencePopover4RefFlag(container_klass, refferen
           // 引用数据
           const current_refference_obj = {
             refference: {
-              chunk_id: target_chunk.chunk_id,
+              chunk_id: target_chunk.id,
               content_ltks: target_chunk.content_ltks,
-              content_with_weight: target_chunk.content_with_weight,
-              doc_id: target_chunk.doc_id,
-              docnm_kwd: target_chunk.docnm_kwd,
-              img_id: target_chunk.img_id,
+              content_with_weight: target_chunk.content,
+              doc_id: target_chunk.document_id,
+              docnm_kwd: target_chunk.document_name,
+              img_id: target_chunk.image_id,
               important_kwd: target_chunk.important_kwd,
               kb_id: target_chunk.kb_id,
               positions: target_chunk.positions,

+ 139 - 139
src/views/conversation/ConversationChatContainer.vue

@@ -810,144 +810,144 @@ const sseOnMessage = (ev) => {
   }
 };
 
-/**
- * ------------------------------------------------------------
- * websocket定义以及初始化
- */
-const wsTrigger = {
-  /**
-   * 当websocket消息回来后
-   * @param e
-   */
-  onMessage: handleWSMessage,
-  /**
-   * 当websocket消息出错时
-   * @param e
-   */
-  onError: handleWSError,
-  /**
-   * 当websocket消息关闭时
-   * @param e
-   */
-  onClose: handleWSClose
-};
-
-/**
- * 初始化websocket相关的一些方法
- */
-const { initWSConnection, sendWSMessage, getWSInstance, closeWSConnect } = useWebSocketChat(wsTrigger);
-
-/**
- * 发送websocket消息
- * @param chat_id - 对话记录的ID
- * @param value
- */
-function handleWSSend(chat_id, value) {
-  /**
-   * -----------------------------------------------------------
-   * -----------------------------------------------------------
-   * -----------------------------------------------------------
-   * websocket消息正式发送,发送步骤:
-   * 1. 初始化链接
-   * 2. 发送消息
-   */
-
-  //  初始化websocket连接
-  const menu_id = current_menu_id.value;
-  initWSConnection(props.agent_id, chat_id, menu_id);
-  // 发送socket连接
-  sendWSMessage(value);
-  // 统计会话发起的次数
-  chat_round_sent_count.value = chat_round_sent_count.value + 1;
-  /**
-   * websocket消息发送流程完成
-   * ------------------------------------------------------------
-   * ------------------------------------------------------------
-   * ------------------------------------------------------------
-   */
-}
-
-/**
- * 接收websocket消息
- * @param e
- */
-function handleWSMessage(e) {
-  const res_data = e.data;
-
-  // 获取当前对话中最后一个对话数据
-  // 最后一个对话数据为当前正在进行的对话
-  const last_msg = chat_new_list.value[chat_new_list.value.length - 1];
-
-  /**
-   * 整理返回的数据
-   */
-  const currentChat = formatDialogAnswerFromWebsocketReceiveMessage(res_data, last_msg, props.CHAT_AGENT_INFOMATION);
-  const chat_status = currentChat.status;
-  const chat_message = currentChat.message;
-
-  // 处理对话数据
-  const handleChatData = () => {
-    const chat_data = currentChat.data; // 对话相关的数据项
-
-    // 原来的最后一项弹出
-    chat_new_list.value.pop();
-    // 添加新的最后一项
-    chat_new_list.value.push(chat_data);
-
-    // 滚动到底部
-    scroll2ListBottom();
-  };
-
-  if (chat_status === 0) {
-    // 未开始: 此状态不存在,无需处理
-  }
-
-  if (chat_status === 1) {
-    // 此轮对话仍然在进行中
-    handleChatData();
-  }
-
-  if (chat_status === 2) {
-    // 此轮对话已结束
-    handleChatData();
-
-    // 对话已结束:检查是否存在推荐数据
-    const chat_suggest = currentChat.suggest; // 对话相关的推荐数据
-    if (chat_suggest) {
-      chat_suggestion.value = chat_suggest;
-    }
-
-    // 对话已结束:文件上传、文本输入区域放开使用
-    input_disabled.value = false;
-  }
-
-  if (chat_status === 3) {
-    // 此轮对话出错了
-    // TODO: 错误处理
-
-    // 此轮对话已结束
-    handleChatData();
-    // 对话已结束:文件上传、文本输入区域放开使用
-    input_disabled.value = false;
-  }
-}
-
-/**
- * 处理websocket错误
- * @param e
- */
-function handleWSError(e) {
-  console.log('socket-error-8jfdksagjsfdjaklnfsdajkl', e);
-  handleChatRequestionException({
-    message: `对话无法继续:WebSocket Error: ${e.target.url}`
-  });
-}
-
-/**
- * 处理websocket关闭事件
- * @param e
- */
-function handleWSClose(e) {}
+// /**
+//  * ------------------------------------------------------------
+//  * websocket定义以及初始化
+//  */
+// const wsTrigger = {
+//   /**
+//    * 当websocket消息回来后
+//    * @param e
+//    */
+//   onMessage: handleWSMessage,
+//   /**
+//    * 当websocket消息出错时
+//    * @param e
+//    */
+//   onError: handleWSError,
+//   /**
+//    * 当websocket消息关闭时
+//    * @param e
+//    */
+//   onClose: handleWSClose
+// };
+
+// /**
+//  * 初始化websocket相关的一些方法
+//  */
+// const { initWSConnection, sendWSMessage, getWSInstance, closeWSConnect } = useWebSocketChat(wsTrigger);
+
+// /**
+//  * 发送websocket消息
+//  * @param chat_id - 对话记录的ID
+//  * @param value
+//  */
+// function handleWSSend(chat_id, value) {
+//   /**
+//    * -----------------------------------------------------------
+//    * -----------------------------------------------------------
+//    * -----------------------------------------------------------
+//    * websocket消息正式发送,发送步骤:
+//    * 1. 初始化链接
+//    * 2. 发送消息
+//    */
+
+//   //  初始化websocket连接
+//   const menu_id = current_menu_id.value;
+//   initWSConnection(props.agent_id, chat_id, menu_id);
+//   // 发送socket连接
+//   sendWSMessage(value);
+//   // 统计会话发起的次数
+//   chat_round_sent_count.value = chat_round_sent_count.value + 1;
+//   /**
+//    * websocket消息发送流程完成
+//    * ------------------------------------------------------------
+//    * ------------------------------------------------------------
+//    * ------------------------------------------------------------
+//    */
+// }
+
+// /**
+//  * 接收websocket消息
+//  * @param e
+//  */
+// function handleWSMessage(e) {
+//   const res_data = e.data;
+
+//   // 获取当前对话中最后一个对话数据
+//   // 最后一个对话数据为当前正在进行的对话
+//   const last_msg = chat_new_list.value[chat_new_list.value.length - 1];
+
+//   /**
+//    * 整理返回的数据
+//    */
+//   const currentChat = formatDialogAnswerFromWebsocketReceiveMessage(res_data, last_msg, props.CHAT_AGENT_INFOMATION);
+//   const chat_status = currentChat.status;
+//   const chat_message = currentChat.message;
+
+//   // 处理对话数据
+//   const handleChatData = () => {
+//     const chat_data = currentChat.data; // 对话相关的数据项
+
+//     // 原来的最后一项弹出
+//     chat_new_list.value.pop();
+//     // 添加新的最后一项
+//     chat_new_list.value.push(chat_data);
+
+//     // 滚动到底部
+//     scroll2ListBottom();
+//   };
+
+//   if (chat_status === 0) {
+//     // 未开始: 此状态不存在,无需处理
+//   }
+
+//   if (chat_status === 1) {
+//     // 此轮对话仍然在进行中
+//     handleChatData();
+//   }
+
+//   if (chat_status === 2) {
+//     // 此轮对话已结束
+//     handleChatData();
+
+//     // 对话已结束:检查是否存在推荐数据
+//     const chat_suggest = currentChat.suggest; // 对话相关的推荐数据
+//     if (chat_suggest) {
+//       chat_suggestion.value = chat_suggest;
+//     }
+
+//     // 对话已结束:文件上传、文本输入区域放开使用
+//     input_disabled.value = false;
+//   }
+
+//   if (chat_status === 3) {
+//     // 此轮对话出错了
+//     // TODO: 错误处理
+
+//     // 此轮对话已结束
+//     handleChatData();
+//     // 对话已结束:文件上传、文本输入区域放开使用
+//     input_disabled.value = false;
+//   }
+// }
+
+// /**
+//  * 处理websocket错误
+//  * @param e
+//  */
+// function handleWSError(e) {
+//   console.log('socket-error-8jfdksagjsfdjaklnfsdajkl', e);
+//   handleChatRequestionException({
+//     message: `对话无法继续:WebSocket Error: ${e.target.url}`
+//   });
+// }
+
+// /**
+//  * 处理websocket关闭事件
+//  * @param e
+//  */
+// function handleWSClose(e) {}
 
 onMounted(() => {
   const agent_id = props.agent_id;
@@ -1006,7 +1006,7 @@ onMounted(() => {
 // ---------------------------------------------------------
 onUnmounted(() => {
   // 组件卸载,关闭组件内的websocket连接
-  closeWSConnect();
+  // closeWSConnect();
 });
 </script>