From a4ca216c5b215f323b3c439b2f445dad72bbfce1 Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期一, 26 八月 2024 16:44:31 +0800 Subject: [PATCH] fix: 修改bug --- src/views/dmx/IntelligentAgent/components/addAgent.vue | 239 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 126 insertions(+), 113 deletions(-) diff --git a/src/views/dmx/IntelligentAgent/components/addAgent.vue b/src/views/dmx/IntelligentAgent/components/addAgent.vue index cbfb80d..ee4a9bb 100644 --- a/src/views/dmx/IntelligentAgent/components/addAgent.vue +++ b/src/views/dmx/IntelligentAgent/components/addAgent.vue @@ -1,29 +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 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> - <editAgent ref="editAgentKuai" typeAngint="add" :formData="form" @cancelModal="handleCancel"></editAgent> + <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> @@ -31,106 +50,100 @@ </template> <script lang="ts" setup> -import { onMounted ,onBeforeMount, reactive, ref } from "vue"; -import editAgent from "@/views/dmx/IntelligentAgent/components/editAgent.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 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 - } - ] - }, - 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 -}); -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, + }, + ], }, - ], -} + kb_ids: [], + 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, + }); + const formRef = ref(null); + const rules = { + name: [ + { + required: true, + message: '鍚嶇О涓嶅厑璁镐负绌�', + }, + ], + }; -const handleSubmit = ({values, errors}) => { - console.log('values:', values, '\nerrors:', errors) - if(!errors){ - editAgentKuai.value.handleClick(form) - } -} + const handleSubmit = ({ values, errors }) => { + console.log('values:', values, '\nerrors:', errors); + if (!errors) { + editAgentKuai.value.handleClick(form); + } + }; -const handleClick = () => { - visible.value = true; -}; -defineExpose({ - handleClick -}) + const handleClick = () => { + visible.value = true; + }; + defineExpose({ + handleClick, + }); -const handleCancel = () => { - visible.value = false; - formRef.value.resetFields(); - form.name = '' -} + const handleCancel = () => { + visible.value = false; + formRef.value.resetFields(); + form.name = ''; + }; -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 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'+ + '{knowledge}'; + }; -const file = ref(); + const file = ref(); -onBeforeMount(()=>{ - -}) -onMounted(()=>{ - - -}) -</script> \ No newline at end of file + onBeforeMount(() => {}); + onMounted(() => {}); +</script> -- Gitblit v1.8.0