Prechádzať zdrojové kódy

doc: 完善注释,移除无用代码

zhupei@smartai.com 1 rok pred
rodič
commit
e7b82a9934

+ 0 - 8
src/modules/conversation-chat/DialogAsideLeft.vue

@@ -10,14 +10,6 @@
 
 <style lang="css" scoped>
 .dialog-aside-left {
-  /* margin-top: 30px;
-  margin-bottom: 30px; */
-
-  /* text-align: center; */
-
-  /* font-size: 32px;
-  font-weight: bold; */
-
   color: var(--color-text-1);
 }
 </style>

+ 0 - 8
src/modules/conversation-chat/DialogAsideRight.vue

@@ -10,14 +10,6 @@
 
 <style lang="css" scoped>
 .dialog-aside-right {
-  /* margin-top: 30px;
-  margin-bottom: 30px;
-
-  text-align: center; */
-
-  /* font-size: 32px;
-  font-weight: bold; */
-
   color: var(--color-text-1);
 }
 </style>

+ 0 - 4
src/modules/conversation-chat/DialogHeader.vue

@@ -12,14 +12,10 @@ const props = defineProps({
 
 <style lang="css" scoped>
 .dialog-header {
-  /* margin-top: 30px;
-  margin-bottom: 30px; */
   display: flex;
   justify-content: center;
   align-items: center;
 
-  /* text-align: center; */
-
   color: var(--color-text-1);
 }
 </style>

+ 1 - 10
src/modules/conversation-chat/DialogList.vue

@@ -1,7 +1,7 @@
 <template>
   <a-scrollbar type="track" :style="container_style" ref="scroll_container">
-    <!-- <div class="scroll-left">左侧</div> -->
     <slot name="left"></slot>
+
     <div class="dialog-list dialog-markdown-container">
       <DialogItem
         v-for="(item, index) of list"
@@ -16,7 +16,6 @@
       <DialogSuggestion v-if="suggestion.length !== 0" :suggestion="suggestion" />
     </div>
 
-    <!-- <div class="scroll-right">右侧</div> -->
     <slot name="right"></slot>
   </a-scrollbar>
 </template>
@@ -86,12 +85,4 @@ defineExpose({
   color: var(--color-text-1);
   flex-grow: 1;
 }
-
-/* .scroll-left {
-  width: 25%;
-}
-
-.scroll-right {
-  width: 25%;
-} */
 </style>

+ 0 - 2
src/modules/conversation-content/DialogCode.vue

@@ -7,8 +7,6 @@
 <script setup>
 import { onMounted, computed } from 'vue';
 
-// import { applyHighLight } from '../conversation-dialog/format-code-string';
-
 /**
  * 此组件展示对话中的代码
  * 例如python代码、SQL代码

+ 7 - 13
src/modules/conversation-dialog/api-dialog.js

@@ -1,6 +1,6 @@
 import ajax from '../../base/ajax';
 
-import { kuky_Authorization } from '../../base/storage';
+// import { kuky_Authorization } from '../../base/storage';
 
 /**
  * 上传文件
@@ -71,10 +71,10 @@ export const files2Formdata = (f_list, key_name) => {
 
 /**
  * 根据智能体上传文件
- * @param {*} agent_id
- * @param {*} chat_id
- * @param {*} client_file
- * @param {*} menu_id
+ * @param {String} agent_id
+ * @param {String} chat_id
+ * @param {Object} client_file
+ * @param {Number} menu_id
  */
 export const uploadFileByAgentInfo = async (agent_id, chat_id, client_file, menu_id) => {
   let files_response = null;
@@ -148,16 +148,10 @@ export const getDialogChatId = (agent_id) => {
   return ajax.get(`/api/agent/get-chat-id/${agent_id}`);
 };
 
-// /**
-//  * 获取某个agent的所有对话记录
-//  * @returns {Promise<Object>}
-//  */
-// const getDialogs = (agent_id) => {
-//   return ajax.get(`/api/agent/${agent_id}/sessions`);
-// };
-
 /**
  * 获取某个对话的对话记录
+ * @param {String} agent_id - 智能体的ID
+ * @param {String} conversation_id - 会话ID
  * @returns {Promise<Object>}
  */
 export const getHistoryLogs = (agent_id, conversation_id) => {

+ 1 - 1
src/modules/conversation-dialog/format-dialog-answer-attached-html-before-render.js

@@ -14,7 +14,7 @@ import {
  * 此方法所做的事情就是生成上述步骤3所需要的 特殊情况下的其他html字符串
  * 最终将该html字符串,赋给 client_custom_attached_html_before_render 属性
  * 在 ../conversation-item/DialogAnswer.vue 组件中,会进行上述步骤2和步骤3的处理
- * @param {object} currentMsg - 前一次的消息,如果是流式消息,则需要上一次的Content进行拼接,从而形成新的消息
+ * @param {object} currentMsg - 当前答案项
  * @returns
  */
 export default function formatDialogAnswerAttachedHtmlBeforeRender(currentMsg) {

+ 0 - 35
src/modules/conversation-dialog/format-dialog-answer-custom-markdown-str.js

@@ -42,33 +42,6 @@ export function formatRefferenceString(refference, field_key) {
 
   // 仅返回一个容器,模板内容通过组件生成
   return `<div class="client-formated-markdown-element-item client-formated-markdown-doc-refference-container"></div>`;
-
-  // const refs_markdown = [];
-  // if (Array.isArray(doc_aggs)) {
-  //   doc_aggs.forEach((item, index) => {
-  //     refs_markdown.push(
-  //       `<li
-  //         class="client-formated-markdown-element-item client-formated-markdown-doc-refference-item"
-  //         data-doc-id="${item.doc_id}"
-  //         data-real-index="${index}"
-  //         data-ref-key="${field_key}"
-  //       >
-  //         <span class="refference-index">${index + 1}</span>
-  //         <span class="refference-label">${item.doc_name}</span>
-  //       </li>`
-  //     );
-  //   });
-  // }
-
-  // const li_str = refs_markdown.join('');
-
-  // const ref_header = `<header class="client-formated-markdown-element-item client-formated-markdown-refference-header">
-  //   <div>来源</div>
-  //   <div>查看全部关联</div>
-  // </header>`;
-  // const ref_list = `<ul class="client-formated-markdown-element-item client-formated-markdown-doc-refference-container" data-ref-key="${field_key}">${li_str}</ul>`;
-
-  // return `${ref_header} ${ref_list}`;
 }
 
 export function formatRefferenceFlag(answer) {
@@ -113,16 +86,8 @@ export function formatFileDownloadStr(file_name, file_url, file_id) {
     return '';
   }
 
-  // let real_url = file_url.replace('//', '/');
-  // real_url = file_url.replace('/./', '/');
-  // real_url = file_url.replace('./', '/');
-  // real_url = formatStaticAssetsUrl(real_url);
-
   const real_url = formatFileDownloadUrl(file_url);
 
-  // const token = kuky_Authorization.get();
-  // real_url = useAttachQueryValue(real_url, 'token', token);
-
   return `<div class="client-formated-markdown-element-item client-formated-download-container">
     <a class="download-link" href="${real_url}" target="_blank">
       <span class="download-icon">

+ 0 - 4
src/modules/conversation-dialog/format-dialog-answer-from-history.js

@@ -1,12 +1,8 @@
 import generateClientUniqueId from '../../utils/generate-client-unique-id';
-// import { jsonParse, jsonStringify } from '../../utils/utils';
 
 import { formatCodePython, formatCodeSql } from './format-code-string';
 import { getIcon4Answer } from './get-icon-4-dialog';
 
-// import formatAnwserString from './format-anwser-string';
-// import { formatStaticAssetsUrl } from '../../utils/utils';
-
 import {
   formatRefferenceString,
   formatRefferenceFlag,

+ 0 - 3
src/modules/conversation-dialog/format-dialog-answer-from-websocket_receive_message.js

@@ -1,10 +1,7 @@
 import { jsonParse, jsonStringify } from '../../utils/utils';
-// import { formatStaticAssetsUrl } from '../../utils/utils';
 import generateClientUniqueId from '../../utils/generate-client-unique-id';
 
 import { formatCodePython, formatCodeSql } from './format-code-string';
-// import formatAnwserString, { formatMarkdownString } from './format-anwser-string';
-// import { formatFileDownloadStr } from './format-dialog-answer-custom-markdown-str';
 import { getIcon4Answer } from './get-icon-4-dialog';
 
 import {