From da555b0e8e1ff75b3daa4fe62d1b3337b2aae72d Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期二, 06 八月 2024 18:58:50 +0800
Subject: [PATCH] 智能体配置页面修改

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

diff --git a/src/views/dmx/IntelligentAgent/components/agentConfig.vue b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
index 28c015e..f825885 100644
--- a/src/views/dmx/IntelligentAgent/components/agentConfig.vue
+++ b/src/views/dmx/IntelligentAgent/components/agentConfig.vue
@@ -1,9 +1,23 @@
 <template>
-  <a-button type="primary" @click="handleClick" style="margin-left: 10px">
+  <a-button
+    v-if="typeAngint == 'add'"
+    type="primary"
+    @click="handleClick"
+    style="margin-left: 10px">
     <template #icon>
       <icon-plus />
     </template>
     鏂板缓鏅鸿兘浣�
+  </a-button>
+  <a-button
+    v-if="typeAngint == 'edit'"
+    type="text"
+    size="small"
+    @click="editClick"
+  >
+    <template #icon>
+      <icon-tool />
+    </template>
   </a-button>
   <a-modal
     v-model:visible="visible"
@@ -285,9 +299,8 @@
 import useLoading from "@/hooks/loading";
 import { Message } from "@arco-design/web-vue";
 import { dialogSet } from "@/api/Agent";
+import EventBus from "@/utils/EventBus";
 const { loading,setLoading } = useLoading(true);
-const props = defineProps(['typeAngint', 'formData']);
-const emit = defineEmits(['queryList']);
 const visible = ref(false);
 const modelList = ref({});
 const rankModelList = ref({});
@@ -331,7 +344,8 @@
   top_k:1024,
 });
 const height = ref('calc(100vh - 520px)');
-
+const props = defineProps(['typeAngint', 'formData']);
+const emit = defineEmits(['queryList']);
 const columns = [
   {
     title: '鍏抽敭瀛�',
@@ -423,6 +437,7 @@
   formRef1.value.resetFields();
   formRef2.value.resetFields();
   form.name = "";
+  emit('queryList');
 };
 
 const handleOpened = (el) => {
@@ -443,26 +458,26 @@
 
 
 const handleBeforeOk = async (done) => {
-  let valid = '';
-  let valid1 = '';
-  let valid2 = '';
   formRef.value.validate().then(res => {
     console.log('res:', res)
-    valid = res;
   })
   formRef1.value.validate().then(res => {
     console.log('res:', res)
-    valid1 = res;
   })
   formRef2.value.validate().then(res => {
     console.log('res:', res)
-    valid2 = res;
   })
-  if (valid || valid1 || valid2) {
-
-    console.log('璇锋眰鏁版嵁');
+  if (form.name && form.kb_ids.length>0 && form.prompt_config.system && form.llm_id) {
     let title = '鍒涘缓鎴愬姛';
     let formNew = { ...form };
+    if(formNew.rerank_id){
+      delete formNew.top_k;
+    }
+
+    if(formNew.rerank_id){
+      delete formNew.top_k;
+    }
+
     if (props.typeAngint == 'edit') {
       formNew.dialog_id = form.id;
       delete formNew.id;
@@ -472,15 +487,16 @@
     setLoading(true)
     try {
       const data = await dialogSet(formNew);
-      console.log(data.data, 'data');
+      console.log(data, 'data');
       if (data.code == 0){
         Message.success(title);
         handleCancel();
-        emit('queryList');
+        EventBus.emit('queryList');
       }else {
         Message.error(data.msg);
       }
       done(true);
+      setLoading(false)
     } catch (err) {
       // you can report use errorHandler or other
       setLoading(false)
@@ -491,6 +507,12 @@
   }
 };
 
+const editClick = (data) => {
+  visible.value = true;
+  console.log(props.formData,'浼犲叆鏁版嵁');
+  Object.assign(form, props.formData);
+  console.log(form,'琛ㄥ崟鏁版嵁');
+};
 
 const addVariable = () => {
   form.prompt_config.parameters.push({

--
Gitblit v1.8.0