From 8742aa1ca9a96e75c18d4f9e3c52bddd8e190898 Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期一, 05 八月 2024 11:38:14 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/flow_web

---
 src/views/dmx/IntelligentAgent/components/addAgent.vue |  208 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 127 insertions(+), 81 deletions(-)

diff --git a/src/views/dmx/IntelligentAgent/components/addAgent.vue b/src/views/dmx/IntelligentAgent/components/addAgent.vue
index 178d923..8e609d1 100644
--- a/src/views/dmx/IntelligentAgent/components/addAgent.vue
+++ b/src/views/dmx/IntelligentAgent/components/addAgent.vue
@@ -1,26 +1,48 @@
-
 <template>
-<!--  <a-button type="primary" @click="handleClick" style="margin-left: 10px">-->
-<!--    <template #icon>-->
-<!--      <icon-plus />-->
-<!--    </template>-->
-<!--  </a-button>-->
-  <a-modal v-model:visible="visible" title="鍒涘缓鏅鸿兘浣�"
-           @before-open="handleOpened"
-           @cancel="handleCancel"
-           :footer="false"
-           title-align="start"
-           width="600px"
+  <!--  <a-button type="primary" @click="handleClick" style="margin-left: 10px">-->
+  <!--    <template #icon>-->
+  <!--      <icon-plus />-->
+  <!--    </template>-->
+  <!--  </a-button>-->
+  <a-modal
+    v-model:visible="visible"
+    title="鍒涘缓鏅鸿兘浣�"
+    @before-open="handleOpened"
+    @cancel="handleCancel"
+    :footer="false"
+    title-align="start"
+    width="600px"
   >
-    <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit" :style="{width:'90%',margin:'0 auto'}" layout="vertical" >
+    <a-form
+      ref="formRef"
+      :rules="rules"
+      :model="form"
+      @submit="handleSubmit"
+      :style="{ width: '90%', margin: '0 auto' }"
+      layout="vertical"
+    >
       <a-form-item field="name" label="鏅鸿兘浣撳悕绉�">
-        <a-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�"/>
+        <a-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" />
       </a-form-item>
-
+      <a-form-item label="浣犲笇鏈涙櫤鑳戒綋鐨勮鑹叉槸浠�涔堬紝鍏蜂綋瀹屾垚浠�涔堜换鍔★紵">
+        <a-textarea
+          v-model="form.prompt_config.system"
+          placeholder=""
+          style="height: 180px"
+        />
+      </a-form-item>
       <a-form-item>
-        <div style="width: 100%;text-align: right">
+        <div style="width: 100%; text-align: right">
           <a-button @click="visible = false">鍙栨秷</a-button>
-          <a-button style="margin-left: 10px" type="primary" html-type="submit">纭畾</a-button>
+          <a-button style="margin-left: 10px" type="primary" html-type="submit"
+            >纭畾</a-button
+          >
+          <editAgent
+            ref="editAgentKuai"
+            typeAngint="add"
+            :formData="form"
+            @cancelModal="handleCancel"
+          ></editAgent>
         </div>
       </a-form-item>
     </a-form>
@@ -28,75 +50,99 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted ,onBeforeMount, reactive, ref } from "vue";
+  import { onMounted, onBeforeMount, reactive, ref } from 'vue';
+  import editAgent from '@/views/dmx/IntelligentAgent/components/editAgent.vue';
 
-const visible = ref(false);
-const loading = ref(false);
-const form = reactive({
-  size: "medium",
-  name: "",
-  age: undefined,
-  section: "0",
-  province: "haidian",
-  options: [],
-  date: "",
-  time: "",
-  radio: "radio one",
-  slider: 5,
-  score: 5,
-  switch: false,
-  multiSelect: ["section one"],
-  treeSelect: "",
-  raptor: false,
-  prompt: '璇锋�荤粨浠ヤ笅娈佃惤銆� 灏忓績鏁板瓧锛屼笉瑕佺紪閫犮�� 娈佃惤濡備笅锛歕n' +
-    '      {cluster_content}\n' +
-    '浠ヤ笂灏辨槸浣犻渶瑕佹�荤粨鐨勫唴瀹广��',
-});
-const formRef = ref(null);
-
-
-const rules = {
-  name: [
-    {
-      required: true,
-      message:'鍚嶇О涓嶅厑璁镐负绌�',
+  const visible = ref(false);
+  const loading = ref(false);
+  const editAgentKuai = ref();
+  const form = reactive({
+    name: '',
+    icon: '',
+    language: 'English',
+    prompt_config: {
+      empty_response: '',
+      prologue: '浣犲ソ锛� 鎴戞槸浣犵殑鍔╃悊锛屾湁浠�涔堝彲浠ュ府鍒颁綘鐨勫悧锛�',
+      quote: true,
+      self_rag: true,
+      system:
+        '绀轰緥锛歕n' +
+        '浣犳槸 XX锛屽叿鏈� XX 缁忛獙锛屾搮闀� XX锛屸�n' +
+        '浣犵殑浠诲姟鏄� XX 锛岄渶瑕佹寜鐓т互涓嬫楠ゆ墽琛岋細\n' +
+        '1. XX\n' +
+        '2. XX\n' +
+        '3. 鈥n',
+      parameters: [
+        {
+          key: 'knowledge',
+          optional: false,
+        },
+      ],
     },
-  ],
-}
-
-
-const handleSubmit = ({values, errors}) => {
-  console.log('values:', values, '\nerrors:', errors)
-}
-
-const handleClick = () => {
-  visible.value = true;
-};
-defineExpose({
-  handleClick
-})
-
-const handleCancel = () => {
-  visible.value = false;
-}
-
-const handleOpened =(el) => {
-  Object.assign(form,{
-    name: '',// 鐢ㄦ埛鍚�
-    nameJoin: '',// 鏄电О
-    post: '',// 宀椾綅
-    txt: '',// 澶囨敞
+    kb_ids: ['985eda244efc11ef9a7a0242ac120006'],
+    llm_id: 'qwen-plus',
+    llm_setting: {
+      temperature: 0.1,
+      top_p: 0.3,
+      presence_penalty: 0.4,
+      frequency_penalty: 0.7,
+      max_tokens: 512,
+    },
+    similarity_threshold: 0.2,
+    vector_similarity_weight: 0.30000000000000004,
+    top_n: 8,
   });
-  formRef.value.resetFields();
-}
+  const formRef = ref(null);
 
-const file = ref();
+  const rules = {
+    name: [
+      {
+        required: true,
+        message: '鍚嶇О涓嶅厑璁镐负绌�',
+      },
+    ],
+  };
 
-onBeforeMount(()=>{
+  const handleSubmit = ({ values, errors }) => {
+    console.log('values:', values, '\nerrors:', errors);
+    if (!errors) {
+      editAgentKuai.value.handleClick(form);
+    }
+  };
 
-})
-onMounted(()=>{
+  const handleClick = () => {
+    visible.value = true;
+  };
+  defineExpose({
+    handleClick,
+  });
 
+  const handleCancel = () => {
+    visible.value = false;
+    formRef.value.resetFields();
+    form.name = '';
+  };
 
-})
-</script>
\ No newline at end of file
+  const handleOpened = (el) => {
+    // Object.assign(form,{
+    //   name: '',// 鐢ㄦ埛鍚�
+    //   nameJoin: '',// 鏄电О
+    //   post: '',// 宀椾綅
+    //   txt: '',// 澶囨敞
+    // });
+    formRef.value.resetFields();
+    form.name = '';
+    form.prompt_config.system =
+      '绀轰緥锛歕n' +
+      '浣犳槸 XX锛屽叿鏈� XX 缁忛獙锛屾搮闀� XX锛屸�n' +
+      '浣犵殑浠诲姟鏄� XX 锛岄渶瑕佹寜鐓т互涓嬫楠ゆ墽琛岋細\n' +
+      '1. XX\n' +
+      '2. XX\n' +
+      '3. 鈥n';
+  };
+
+  const file = ref();
+
+  onBeforeMount(() => {});
+  onMounted(() => {});
+</script>

--
Gitblit v1.8.0