From f6ba464aa7856b8201e313fe79e651aab34e6509 Mon Sep 17 00:00:00 2001
From: zhangxiao <898441624@qq.com>
Date: 星期一, 05 八月 2024 10:25:44 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/web/flow_web
---
src/views/dmx/IntelligentAgent/components/addAgent.vue | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 148 insertions(+), 0 deletions(-)
diff --git a/src/views/dmx/IntelligentAgent/components/addAgent.vue b/src/views/dmx/IntelligentAgent/components/addAgent.vue
new file mode 100644
index 0000000..8e609d1
--- /dev/null
+++ b/src/views/dmx/IntelligentAgent/components/addAgent.vue
@@ -0,0 +1,148 @@
+<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-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-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">
+ <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>
+ </div>
+ </a-form-item>
+ </a-form>
+ </a-modal>
+</template>
+
+<script lang="ts" setup>
+ 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 handleSubmit = ({ values, errors }) => {
+ console.log('values:', values, '\nerrors:', errors);
+ if (!errors) {
+ editAgentKuai.value.handleClick(form);
+ }
+ };
+
+ const handleClick = () => {
+ visible.value = true;
+ };
+ defineExpose({
+ handleClick,
+ });
+
+ 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 file = ref();
+
+ onBeforeMount(() => {});
+ onMounted(() => {});
+</script>
--
Gitblit v1.8.0