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

fix:首页一些修改,智能体一些修改

hanyang 1 жил өмнө
parent
commit
4c650c1ec7

+ 0 - 1
src/modules/conversation-chat/DialogInput.vue

@@ -10,7 +10,6 @@
           class="chat-textarea-input"
           :placeholder="$t('conversation.input_placholder')"
           v-model="input_text_value"
-          allow-clear
           :auto-size="textarea_size_config"
           @input="handleTextInput"
           @keyup="handleTextKeyUp"

+ 3 - 1
src/modules/conversation-item/DialogAnswer.vue

@@ -25,6 +25,7 @@
             :deep_loading="deep_loading"
             :mind_map_btn="mind_map_btn"
             :answer_status="answer_status"
+            :loading_mind_map="loading_mind_map"
             @toSearchPage="toSearchPage"
             @toShowMindMap="toShowMindMap"
           >
@@ -106,7 +107,8 @@ const props = defineProps({
    */
   width: Number,
 
-  answer_action_list: Array
+  answer_action_list: Array,
+  loading_mind_map: Boolean
 });
 
 const emit = defineEmits(['stop', 'retry', 'select', 'edit', 'toSearchPage', 'download', 'toShowMindMap']);

+ 3 - 3
src/modules/intelligent/rgflow/AgentConfig.vue

@@ -115,9 +115,9 @@
                 <a-form-item label="Top N">
                   <a-slider v-model="form.top_n" :min="0" :max="30" />
                 </a-form-item>
-                <a-form-item :label="$t('management.rg_config.similarity_weight')">
+                <a-form-item :label="$t('management.rg_config.multi_dialog')">
                   <a-space direction="vertical">
-                    <a-switch v-model="form.prompt_config.multi_dialog" size="small" />
+                    <a-switch v-model="form.prompt_config.refine_multiturn" size="small" />
                   </a-space>
                 </a-form-item>
                 <a-form-item :label="$t('management.rg_config.use_kg')">
@@ -365,7 +365,7 @@ const form = reactive({
     keyword: false,
     tts: false,
     refine_multiturn: true,
-    use_kg: false,
+    use_kg: true,
     system:
       '你是一个智能助手,请总结知识库的内容来回答问题,请列举知识库中的数据详细回答。当所有知识库内容都与问题无关时,你的回答必须包括“知识库中未找到您要的答案!”这句话。' +
       '回答需要考虑聊天历史。\n        以下是知识库:\n        {knowledge}\n        以上是知识库。',

+ 7 - 1
src/modules/model-manage/dify/CollapseItem.vue

@@ -1,7 +1,10 @@
 <template>
   <div class="collapse-item">
     <div class="name">{{ models.model }}</div>
-    <a-tag>{{ models.model_type }}</a-tag>
+    <div class="tag">
+      <a-tag>{{ models.model_type }}</a-tag>
+    </div>
+
     <!-- <div class="name">{{ models.type }}</div> -->
     <!-- <a-button type="primary" @click="toUse">{{ $t('management.useBtn') }}</a-button> -->
     <icon-delete class="delete-icon" @click="toDelete(models)" />
@@ -35,6 +38,9 @@ const toDelete = (name) => {
   font-size: 14px;
   font-weight: bold;
 }
+.tag {
+  min-width: 150px;
+}
 
 .delete-icon {
   font-size: 20px;

+ 1 - 1
src/modules/model-manage/dify/ModelList.vue

@@ -71,7 +71,7 @@ const emit = defineEmits(['showMore', 'updateAddModelDify', 'toAddModel']);
 const delete_visible = ref(false);
 const delete_llm = ref({});
 
-const { beforeEnter, enter, leave } = useCollapse(500);
+const { beforeEnter, enter, leave } = useCollapse(1000);
 
 const handlerAddModel = () => {
   emit('toAddModel', props.model_name);

+ 6 - 2
src/modules/model-manage/ragflow/CollapseItem.vue

@@ -1,7 +1,9 @@
 <template>
   <div class="collapse-item">
     <div class="name">{{ models.name }}</div>
-    <a-tag>{{ models.type }}</a-tag>
+    <div class="tag">
+      <a-tag>{{ models.type }}</a-tag>
+    </div>
     <!-- <div class="name">{{ models.type }}</div> -->
     <!-- <a-button type="primary" @click="toUse">{{ $t('management.useBtn') }}</a-button> -->
     <icon-delete class="delete-icon" @click="toDelete(models.name)" />
@@ -35,7 +37,9 @@ const toDelete = (name) => {
   font-size: 14px;
   font-weight: bold;
 }
-
+.tag {
+  min-width: 150px;
+}
 .delete-icon {
   font-size: 20px;
   color: rgb(var(--orange-5));

+ 9 - 8
src/modules/model-manage/ragflow/MessageBody.vue

@@ -183,6 +183,7 @@ const un_added_data = ref([
     img_src: 'modelFrame10'
   }
 ]);
+const rag_all_data = ref({});
 const rag_added_data = ref({});
 const rag_unadded_data = ref([]);
 // 展开收起状态
@@ -234,6 +235,7 @@ const getUnaddedModelsRGFun = async () => {
   try {
     const res = await getUnaddedModelsRG();
     if (res.code / 1 === 0) {
+      rag_all_data.value = res.data;
       const keys = Object.keys(rag_added_data.value);
       if (keys.length) {
         rag_unadded_data.value = res.data
@@ -243,13 +245,12 @@ const getUnaddedModelsRGFun = async () => {
             );
           })
           .filter((item) => !keys.includes(item.name));
-      }else {
-        rag_unadded_data.value = res.data
-          .filter((item) => {
-            return ['OpenAI', 'Ollama', 'DeepSeek', 'OpenAI-API-Compatible', 'Xinference', 'HuggingFace'].includes(
-              item.name
-            );
-          })
+      } else {
+        rag_unadded_data.value = res.data.filter((item) => {
+          return ['OpenAI', 'Ollama', 'DeepSeek', 'OpenAI-API-Compatible', 'Xinference', 'HuggingFace'].includes(
+            item.name
+          );
+        });
       }
     }
   } catch (e) {
@@ -261,7 +262,7 @@ const updateModelList = async () => {
   await getUnaddedModelsRGFun();
 };
 const toAddModel = (name) => {
-  const item = rag_unadded_data.value.find((item) => item.name === name);
+  const item = rag_all_data.value.find((item) => item.name === name);
   handleAddModel(item);
 };
 const handleAddModel = async (item) => {

+ 1 - 1
src/modules/model-manage/ragflow/ModelList.vue

@@ -71,7 +71,7 @@ const emit = defineEmits(['showMore', 'updateAddModelRG', 'toAddModel']);
 const delete_visible = ref(false);
 const delete_llm_name = ref('');
 
-const { beforeEnter, enter, leave } = useCollapse(500);
+const { beforeEnter, enter, leave } = useCollapse(1000);
 
 const handlerAddModel = () => {
   emit('toAddModel', props.model_name);

+ 1 - 1
src/modules/model-manage/use-collapse.js

@@ -1,7 +1,7 @@
 import { ref } from 'vue';
 
 // 自定义 Hook 用于过渡效果
-export function useCollapse(initialMaxHeight = 500) {
+export function useCollapse(initialMaxHeight = 1000) {
   const collapseMaxHeight = ref(initialMaxHeight); // 固定的最大高度
   // 过渡钩子 - 在元素开始进入时
   const beforeEnter = (el) => {

+ 50 - 16
src/views/conversation/ConversationChatContainer.vue

@@ -349,10 +349,21 @@ const style_conversation_chat_web_page = computed(() => {
 });
 const style_conversation_chat_mind_map = computed(() => {
   if (show_mind_map.value) {
-    return {
-      height: 330 + 'px',
-      transition: 'all 0.2s ease'
-    };
+    if (!isFullScreen.value) {
+      return {
+        height: 330 + 'px',
+        transition: 'all 0.2s ease'
+      };
+    } else {
+      return {
+        height: window.innerHeight - 90 + 'px',
+        width: window.innerWidth - 10 + 'px',
+        position: 'absolute',
+        top: '0',
+        left: '0',
+        zIndex: '9995'
+      };
+    }
   } else {
     return {
       display: 'none'
@@ -913,13 +924,16 @@ const toggleRight = () => {
       search_list.value = last.client_custom_item_internet_list;
     }
     if (last.client_custom_item_mind_map) {
-      show_mind_map.value = true;
-      getMindMapData({ messageId: last.client_custom_chat_message_id.value, query: mindMap_txt.value }).then((res) => {
-        if (res.code / 1 === 200) {
-          mindMap_str.value = res.data.mindmap;
-          mindMap_content.value = res.data.mindmap;
-        }
-      });
+      // show_mind_map.value = true;
+      toShowMindMap({ client_custom_chat_message_id: last.client_custom_chat_message_id });
+      // getMindMapData({ messageId: last.client_custom_chat_message_id.value, query: mindMap_txt.value }).then((res) => {
+      //   if (res.code / 1 === 200) {
+      //     setTimeout(() => {
+      //       mindMap_str.value = res.data.mindmap;
+      //       mindMap_content.value = res.data.mindmap;
+      //     }, 200);
+      //   }
+      // });
     }
   } else {
     show_mind_map.value = false;
@@ -960,20 +974,24 @@ const toFullScreen = () => {
 
   // 动态设置div高度为屏幕可见高度(排除浏览器头部)
   if (fullScreen_mindMap.value) {
+    isFullScreen.value = true;
     // 存储原始高度,进入全屏时恢复
     original_obj.value.height = fullScreen_mindMap.value.style.height;
     original_obj.value.width = fullScreen_mindMap.value.style.width;
     original_obj.value.position = fullScreen_mindMap.value.style.position;
     original_obj.value.zIndex = fullScreen_mindMap.value.style.zIndex;
+    console.log(original_obj.value);
     // 设置div高度为视口高度,避免覆盖浏览器头部
+    // fullScreen_mindMap.value.style.removeProperty('height');
     fullScreen_mindMap.value.style.height = window.innerHeight - 90 + 'px';
     fullScreen_mindMap.value.style.width = window.innerWidth - 10 + 'px';
     fullScreen_mindMap.value.style.position = 'absolute';
     fullScreen_mindMap.value.style.top = '0';
     fullScreen_mindMap.value.style.left = '0';
     fullScreen_mindMap.value.style.zIndex = '9995';
-    isFullScreen.value = true;
-    zoomReset();
+
+    console.log(fullScreen_mindMap.value.style.height);
+    // zoomReset();
   }
 };
 // 退出全屏模式的函数
@@ -1445,6 +1463,7 @@ const toGenerateMindMap = async () => {
         mindMap_err.value = '';
         // 判断如果生成思维导图显示右侧按钮
         show_right_page_btn.value = true;
+        show_right_page_btn.value = true;
         if (!res.data.mindmap) {
           mindMap_err.value = '文本内容太少,不足以生成思维导图';
         }
@@ -1605,7 +1624,8 @@ const stopResponse = () => {
 const toShowRightBtn = () => {
   if (chat_display_list.value.length) {
     const last_item = chat_display_list.value.at(-1);
-    if (last_item.mindmap) {
+    console.log(last_item);
+    if (last_item.client_custom_item_mind_map) {
       show_right_page_btn.value = true;
     }
     if (last_item.client_custom_item_internet && last_item.client_custom_item_internet_list.length) {
@@ -1613,6 +1633,17 @@ const toShowRightBtn = () => {
     }
   }
 };
+watch(
+  () => style_conversation_chat_mind_map.value,
+  () => {
+    if (mind_map.value) {
+      zoomReset();
+    }
+  },
+  {
+    deep: true
+  }
+);
 
 watch(
   () => props.agent_id,
@@ -1664,6 +1695,8 @@ watch(
             }
 
             chat_log_list.value = list;
+            // 处理最后一项是否有思维导图或者网页,有的话展示右侧按钮
+            toShowRightBtn();
           } else {
             // 异常
             // TODO:处理异常
@@ -1745,7 +1778,7 @@ onMounted(() => {
           }
 
           chat_log_list.value = list;
-          // 处理最后一项是否有思维导图或者网页,有的话暂时右侧按钮
+          // 处理最后一项是否有思维导图或者网页,有的话展示右侧按钮
           toShowRightBtn();
         } else {
           // 异常
@@ -1844,6 +1877,7 @@ defineExpose({
   overflow: hidden;
   height: 100%;
   text-align: right;
+  margin-right: 10px;
 }
 .conversation-chat-expand {
   text-align: right;
@@ -1906,7 +1940,7 @@ defineExpose({
   height: calc(100% - 60px);
   display: flex;
   flex-direction: column;
-
+  gap: 40px;
   overflow: hidden;
 
   padding-top: 8px;

+ 3 - 3
vite.config.mjs

@@ -48,7 +48,7 @@ export default defineConfig(({ mode }) => {
 
         '/dify': {
           target: 'http://192.168.20.119:28003/',
-          // target: 'http://192.168.20.119:13002',
+          // target: 'http://47.96.40.148:8163',
           changeOrigin: true,
           secure: false,
           ws: true,
@@ -56,9 +56,9 @@ export default defineConfig(({ mode }) => {
         },
         '/rgflow': {
           // target: 'http://192.168.20.119:11080',
-          target: 'http://smartai.com:8294/', //119 rag
+          // target: 'http://smartai.com:8294/', //119 rag
           // target: 'http://192.168.20.116:28002/',
-          // target: 'http://47.96.40.148:8162/',
+          target: 'http://47.96.40.148:8162/',
           changeOrigin: true,
           secure: false,
           ws: true,