From ffdde4d7d6a1bfc071816e358942370bdfafbb9a Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期二, 13 八月 2024 14:56:17 +0800
Subject: [PATCH] 智能体列表查询

---
 src/views/dmx/IntelligentAgent/components/agentConfig.vue |   50 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/views/dmx/IntelligentAgent/components/agentConfig.vue b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
index 4c23cd3..2c6c42f 100644
--- a/src/views/dmx/IntelligentAgent/components/agentConfig.vue
+++ b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
@@ -49,9 +49,10 @@
                 <a-form-item label="鏅鸿兘浣撳浘鏍�">
                   <a-space direction="vertical" :style="{ width: '100%' }">
                     <Upload
+                      v-if="avatarShow"
                       :action="uploadAction"
                       :limit="1"
-                      :url="httpUrl + form.icon"
+                      :url="form.icon ? httpUrl + form.icon : ''"
                       @update:fileList="updateFileList"
                       @success="handleSuccess"
                     ></Upload>
@@ -162,8 +163,8 @@
                   :data="form.prompt_config.parameters"
                   style="width: 100%"
                 >
-                  <template #key="{ record, rowIndex }">
-                    <a-input v-model="record.key" placeholder="" />
+                  <template #name="{ record, rowIndex }">
+                    <a-input v-model="record.name" placeholder="" />
 <!--                    <a-input v-model="form.prompt_config.parameters[rowIndex].key" />-->
                   </template>
                   <template #optional="{ record }">
@@ -259,7 +260,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted, onBeforeMount, reactive, ref, nextTick } from "vue";
+import { onMounted, onBeforeMount, reactive, ref, nextTick, onUnmounted, onBeforeUnmount } from "vue";
 import { kbdocumentupload, queryKbList, queryModelList } from "@/api/kbList";
 import useLoading from "@/hooks/loading";
 import { Message } from "@arco-design/web-vue";
@@ -289,6 +290,7 @@
     parameters: [
       {
         index: 0,
+        name: "knowledge",
         key: "knowledge",
         optional: false
       }
@@ -315,6 +317,7 @@
 let frequency_penalty = ref(true);
 let max_tokens = ref(true);
 const httpUrl = localStorage.getItem('httpUrl');
+let avatarShow = ref(true);
 
 const height = ref('calc(500px)');
 const props = defineProps(['typeAngint', 'formData']);
@@ -322,8 +325,8 @@
 const columns = [
   {
     title: '鍏抽敭瀛�',
-    dataIndex: 'key',
-    slotName: 'key',
+    dataIndex: 'name',
+    slotName: 'name',
   },
   {
     title: '鍙��',
@@ -416,13 +419,20 @@
   formRef.value.resetFields();
   formRef1.value.resetFields();
   formRef2.value.resetFields();
+  nextTick(()=>{
+    if(props.typeAngint=='add'){
+      form.name = "";
+      form.icon = "";
+      form.prompt_config.system = "浣犳槸涓�涓櫤鑳藉姪鎵嬶紝璇锋�荤粨鐭ヨ瘑搴撶殑鍐呭鏉ュ洖绛旈棶棰橈紝璇峰垪涓剧煡璇嗗簱涓殑鏁版嵁璇︾粏鍥炵瓟銆傚綋鎵�鏈夌煡璇嗗簱鍐呭閮戒笌闂鏃犲叧鏃讹紝浣犵殑鍥炵瓟蹇呴』鍖呮嫭鈥滅煡璇嗗簱涓湭鎵惧埌鎮ㄨ鐨勭瓟妗堬紒鈥濊繖鍙ヨ瘽銆�" +
+        "鍥炵瓟闇�瑕佽�冭檻鑱婂ぉ鍘嗗彶銆俓n        浠ヤ笅鏄煡璇嗗簱锛歕n        {knowledge}\n        浠ヤ笂鏄煡璇嗗簱銆�";
 
-  if(props.typeAngint=='add'){
-    form.name = "";
-    form.prompt_config.system = "浣犳槸涓�涓櫤鑳藉姪鎵嬶紝璇锋�荤粨鐭ヨ瘑搴撶殑鍐呭鏉ュ洖绛旈棶棰橈紝璇峰垪涓剧煡璇嗗簱涓殑鏁版嵁璇︾粏鍥炵瓟銆傚綋鎵�鏈夌煡璇嗗簱鍐呭閮戒笌闂鏃犲叧鏃讹紝浣犵殑鍥炵瓟蹇呴』鍖呮嫭鈥滅煡璇嗗簱涓湭鎵惧埌鎮ㄨ鐨勭瓟妗堬紒鈥濊繖鍙ヨ瘽銆�" +
-      "鍥炵瓟闇�瑕佽�冭檻鑱婂ぉ鍘嗗彶銆俓n        浠ヤ笅鏄煡璇嗗簱锛歕n        {knowledge}\n        浠ヤ笂鏄煡璇嗗簱銆�";
-  }
-
+    }
+    console.log(form,'鏂板缓鏅鸿兘浣撳脊绐�');
+    avatarShow.value = false;
+    setTimeout(() => {
+      avatarShow.value = true;
+    },100);
+  })
 };
 
 
@@ -446,6 +456,15 @@
     if(formNew.rerank_id){
       delete formNew.top_k;
     }
+
+    formNew.prompt_config.parameters = form.prompt_config.parameters.map(item => {
+      return {
+        ...item,
+        key: item.name
+      }
+    })
+
+    console.log(formNew,'formNew');
 
     if (props.typeAngint == 'edit') {
       formNew.dialog_id = form.id;
@@ -489,6 +508,7 @@
   form.prompt_config.parameters.push({
     index: form.prompt_config.parameters.length,
     key: "",
+    name: "",
     optional: true
   });
   nextTick(() => {
@@ -505,7 +525,6 @@
 
 function handleTabChange(key) {
   // 澶勭悊鏍囩鏀瑰彉浜嬩欢
-  console.log('Changed to tab:', key);
   activeKey.value=key;
 }
 
@@ -549,6 +568,11 @@
 onMounted(() => {});
 
 
+onBeforeUnmount(()=>{
+
+})
+
+
 
 
 </script>

--
Gitblit v1.8.0