فهرست منبع

智能体配置页面修改

liudong 2 سال پیش
والد
کامیت
da555b0e8e

+ 37 - 15
src/views/dmx/IntelligentAgent/components/agentConfig.vue

@@ -1,10 +1,24 @@
 <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"
     title="智能体配置"
@@ -285,9 +299,8 @@ import { kbdocumentupload, queryKbList, queryModelList } from "@/api/kbList";
 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 @@ const form = reactive({
   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 @@ const handleCancel = () => {
   formRef1.value.resetFields();
   formRef2.value.resetFields();
   form.name = "";
+  emit('queryList');
 };
 
 const handleOpened = (el) => {
@@ -443,26 +458,26 @@ const handleOpened = (el) => {
 
 
 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 @@ const handleBeforeOk = async (done) => {
     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 handleBeforeOk = async (done) => {
   }
 };
 
+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({

+ 0 - 1
src/views/dmx/IntelligentAgent/components/editAgent.vue

@@ -213,7 +213,6 @@
 
   const editClick = (data) => {
     visible.value = true;
-
     console.log(props.formData);
     Object.assign(form, props.formData);
     console.log(form);

+ 1 - 1
src/views/dmx/IntelligentAgent/index.vue

@@ -94,7 +94,7 @@
                           <agent-config
                             ref="editAgentKuai"
                             typeAngint="edit"
-                            :formData="form"
+                            :formData="item"
                             @queryList="queryList"
                           ></agent-config>
                         </span>