Ver Fonte

fix:修改模型管理中系统设置无法获取模型,首页增加边距的问题

hanyang há 1 ano atrás
pai
commit
38b8a8f4a3

+ 56 - 15
src/modules/model-manage/ragflow/SystemSetting.vue

@@ -17,7 +17,11 @@
       <a-form :model="form" :layout="layout">
         <a-form-item field="chatModal" label="聊天模型">
           <a-select v-model="form.llm_id" allow-clear>
-            <a-option></a-option>
+            <a-optgroup :label="index" v-for="(item, index) in chatModelList" :key="index">
+              <a-option v-for="obj in item" :key="obj.fid" :disabled="!obj.available" :value="obj.llm_name">
+                {{ obj.llm_name }}
+              </a-option>
+            </a-optgroup>
           </a-select>
         </a-form-item>
         <a-form-item field="innerModal" label="嵌入模型">
@@ -31,12 +35,20 @@
         </a-form-item>
         <a-form-item field="img2txt" label="Img2txt模型">
           <a-select v-model="form.img2txt_id" allow-clear>
-            <a-option></a-option>
+            <a-optgroup :label="index" v-for="(item, index) in img2txtModelList" :key="index">
+              <a-option v-for="obj in item" :key="obj.fid" :disabled="!obj.available" :value="obj.llm_name">
+                {{ obj.llm_name }}
+              </a-option>
+            </a-optgroup>
           </a-select>
         </a-form-item>
         <a-form-item field="sequence2txt" label="Sequence2txt模型">
           <a-select v-model="form.asr_id" allow-clear>
-            <a-option></a-option>
+            <a-optgroup :label="index" v-for="(item, index) in speech2txtModelList" :key="index">
+              <a-option v-for="obj in item" :key="obj.fid" :disabled="!obj.available" :value="obj.llm_name">
+                {{ obj.llm_name }}
+              </a-option>
+            </a-optgroup>
           </a-select>
         </a-form-item>
         <a-form-item field="rerank" label="Rerank模型">
@@ -50,7 +62,11 @@
         </a-form-item>
         <a-form-item field="tts" label="TTS模型">
           <a-select v-model="form.tts_id" allow-clear>
-            <a-option></a-option>
+            <a-optgroup :label="index" v-for="(item, index) in ttsModelList" :key="index">
+              <a-option v-for="obj in item" :key="obj.fid" :disabled="!obj.available" :value="obj.llm_name">
+                {{ obj.llm_name }}
+              </a-option>
+            </a-optgroup>
           </a-select>
         </a-form-item>
       </a-form>
@@ -84,6 +100,10 @@ const form = ref({
 const modelList = ref();
 const innerModelList = ref();
 const rankModelList = ref();
+const chatModelList = ref();
+const ttsModelList = ref();
+const img2txtModelList = ref();
+const speech2txtModelList = ref();
 const loading = ref(false);
 
 const getSystemModelSettingRGFun = async () => {
@@ -110,22 +130,43 @@ const queryModel = async () => {
       }
     }
     modelList.value = arrObj;
-    innerModelList.value = {
-      BAAI: [data.data.BAAI[1]],
-      FastEmbed: data.data.FastEmbed,
-      Xinference: data.data.Xinference,
-      youdao: data.data.Youdao
-    };
-    rankModelList.value = {
-      BAAI: [data.data.BAAI[1]],
-      youdao: data.data.Youdao
-    };
-  } catch (err) {
+    // innerModelList.value = {
+    //   BAAI: [data.data.BAAI[1]],
+    //   FastEmbed: data.data.FastEmbed,
+    //   Xinference: data.data.Xinference,
+    //   youdao: data.data.Youdao
+    // };
+    // rankModelList.value = {
+    //   BAAI: [data.data.BAAI[1]],
+    //   youdao: data.data.Youdao
+    // };
+    chatModelList.value = filterDataByModelType(data.data, 'chat');
+    innerModelList.value = filterDataByModelType(data.data, 'embedding');
+    rankModelList.value = filterDataByModelType(data.data, 'rerank');
+    ttsModelList.value = filterDataByModelType(data.data, 'tts');
+    img2txtModelList.value = filterDataByModelType(data.data, 'image2text');
+    speech2txtModelList.value = filterDataByModelType(data.data, 'speech2text');
     // you can report use errorHandler or other
   } finally {
   }
 };
 
+function filterDataByModelType(data, modelType) {
+  const result = {};
+
+  for (const key in data) {
+    if (data.hasOwnProperty(key)) {
+      result[key] = data[key].filter((item) => item.model_type === modelType && item.available);
+    }
+  }
+  for (const key in result) {
+    if (!result[key].length) {
+      delete result[key];
+    }
+  }
+  return result;
+}
+
 const updateSystemModelSettingRGFun = async () => {
   try {
     loading.value = true;

+ 3 - 2
src/views/conversation/ConversationChatContainer.vue

@@ -249,7 +249,7 @@ const { width: chat_width, height: chat_height } = useEleSizeV1('chat_scrren_con
  * 对话列表区域的高度
  */
 const list_height = computed(() => {
-  return chat_height.value - header_height - footer_height - input_height.value - 20;
+  return chat_height.value - header_height - footer_height - input_height.value - 20 - 40;
 });
 
 const input_style = computed(() => {
@@ -307,7 +307,7 @@ const style_conversation_chat_expand = computed(() => {
 const style_conversation_chat_main_container = computed(() => {
   if (!show_welcome.value) {
     return {
-      height: 80 + '%',
+      height: 'calc(80% - 40px)',
       transition: 'all 0.2s ease'
     };
   } else {
@@ -1962,6 +1962,7 @@ defineExpose({
   flex-grow: 1;
   height: calc(100% - 60px);
   display: flex;
+  gap: 40px;
   flex-direction: column;
   overflow: hidden;
 

+ 0 - 1
src/views/layout/ContentContainer.vue

@@ -49,7 +49,6 @@ const isAlert = () => {
   // 3 天的时间(以毫秒为单位)
   const threeDaysInMilliseconds = 3 * 24 * 60 * 60 * 1000;
   const isWithinThreeDays = Math.abs(timeDifference) <= threeDaysInMilliseconds;
-  console.log(expired_date, now_date, isWithinThreeDays);
   return isWithinThreeDays;
 };
 onMounted(() => {

+ 2 - 2
vite.config.mjs

@@ -36,8 +36,8 @@ export default defineConfig(({ mode }) => {
         '/api/': {
           // target: 'http://smartai.com:8401',
 
-          target: 'http://192.168.20.119:9301',
-          // target: 'http://192.168.20.116:28004',
+          // target: 'http://192.168.20.119:9301',
+          target: 'http://192.168.20.116:28004',
           // target: 'http://smartai.com:8164',
           changeOrigin: true,
           secure: false,