From 7b8ac484c22a2e5b726579b8e13fff5048de0dd5 Mon Sep 17 00:00:00 2001 From: liudong <liudong> Date: 星期三, 07 八月 2024 15:00:17 +0800 Subject: [PATCH] 配置bug页面修改 --- src/views/dmx/IntelligentAgent/components/agentConfig.vue | 76 ++++++++++++++++++++++++++------------ 1 files changed, 52 insertions(+), 24 deletions(-) diff --git a/src/views/dmx/IntelligentAgent/components/agentConfig.vue b/src/views/dmx/IntelligentAgent/components/agentConfig.vue index 28c015e..ff93fc2 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" @@ -18,7 +32,7 @@ > <a-row class=""> <a-col :span="24"> - <a-tabs type="capsule" size="large"> + <a-tabs type="capsule" size="large" v-model="keyLarge" @tab-click="console.log(keyLarge)"> <a-tab-pane key="1" title="鍔╃悊璁剧疆"> <a-divider style="margin-bottom: 20px;margin-top: 0" /> <div style="width: 100%;" :style="{height:height}"> @@ -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({}); @@ -296,6 +309,7 @@ const formRef = ref(); const formRef1 = ref(); const formRef2 = ref(); +const keyLarge = ref('1'); const form = reactive({ name: "", icon: "", @@ -330,8 +344,9 @@ rerank_id:'', top_k:1024, }); -const height = ref('calc(100vh - 520px)'); - +const height = ref('calc(500px)'); +const props = defineProps(['typeAngint', 'formData']); +const emit = defineEmits(['queryList']); const columns = [ { title: '鍏抽敭瀛�', @@ -423,6 +438,7 @@ formRef1.value.resetFields(); formRef2.value.resetFields(); form.name = ""; + emit('queryList'); }; const handleOpened = (el) => { @@ -433,36 +449,39 @@ // txt: '',// 澶囨敞 // }); formRef.value.resetFields(); - form.name = ""; - form.prompt_config.system = "浣犳槸涓�涓櫤鑳藉姪鎵嬶紝璇锋�荤粨鐭ヨ瘑搴撶殑鍐呭鏉ュ洖绛旈棶棰橈紝璇峰垪涓剧煡璇嗗簱涓殑鏁版嵁璇︾粏鍥炵瓟銆傚綋鎵�鏈夌煡璇嗗簱鍐呭閮戒笌闂鏃犲叧鏃讹紝浣犵殑鍥炵瓟蹇呴』鍖呮嫭鈥滅煡璇嗗簱涓湭鎵惧埌鎮ㄨ鐨勭瓟妗堬紒鈥濊繖鍙ヨ瘽銆�" + - "鍥炵瓟闇�瑕佽�冭檻鑱婂ぉ鍘嗗彶銆俓n 浠ヤ笅鏄煡璇嗗簱锛歕n {knowledge}\n 浠ヤ笂鏄煡璇嗗簱銆�"; - formRef.value.resetFields(); formRef1.value.resetFields(); formRef2.value.resetFields(); + + if(props.typeAngint=='add'){ + form.name = ""; + form.prompt_config.system = "浣犳槸涓�涓櫤鑳藉姪鎵嬶紝璇锋�荤粨鐭ヨ瘑搴撶殑鍐呭鏉ュ洖绛旈棶棰橈紝璇峰垪涓剧煡璇嗗簱涓殑鏁版嵁璇︾粏鍥炵瓟銆傚綋鎵�鏈夌煡璇嗗簱鍐呭閮戒笌闂鏃犲叧鏃讹紝浣犵殑鍥炵瓟蹇呴』鍖呮嫭鈥滅煡璇嗗簱涓湭鎵惧埌鎮ㄨ鐨勭瓟妗堬紒鈥濊繖鍙ヨ瘽銆�" + + "鍥炵瓟闇�瑕佽�冭檻鑱婂ぉ鍘嗗彶銆俓n 浠ヤ笅鏄煡璇嗗簱锛歕n {knowledge}\n 浠ヤ笂鏄煡璇嗗簱銆�"; + } + }; const handleBeforeOk = async (done) => { - let valid = ''; - let valid1 = ''; - let valid2 = ''; formRef.value.validate().then(res => { - console.log('res:', res) - valid = res; + // console.log('res:', res) }) formRef1.value.validate().then(res => { - console.log('res:', res) - valid1 = res; + // console.log('res:', res) }) formRef2.value.validate().then(res => { - console.log('res:', res) - valid2 = res; + // console.log('res:', 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 +491,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 +511,14 @@ } }; +const editClick = (data) => { + visible.value = true; + nextTick(()=>{ + console.log(props.formData,'浼犲叆鏁版嵁'); + Object.assign(form, props.formData); + console.log(form,'琛ㄥ崟鏁版嵁'); + }) +}; const addVariable = () => { form.prompt_config.parameters.push({ -- Gitblit v1.8.0