From f06b67a188b9c199c16f418fad3fe6d6267d07a5 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 14 Mar 2025 19:03:45 +0800 Subject: [PATCH] perf: User input interaction style optimization --- .../component/chat-input-operate/index.vue | 1 - .../ai-chat/component/user-form/index.vue | 36 +++-- ui/src/components/ai-chat/index.vue | 149 ++++++++++++------ ui/src/components/icons/index.ts | 21 +++ ui/src/locales/lang/en-US/ai-chat.ts | 3 +- ui/src/locales/lang/zh-CN/ai-chat.ts | 3 +- ui/src/locales/lang/zh-Hant/ai-chat.ts | 3 +- ui/src/views/chat/pc/index.vue | 2 +- 8 files changed, 155 insertions(+), 63 deletions(-) diff --git a/ui/src/components/ai-chat/component/chat-input-operate/index.vue b/ui/src/components/ai-chat/component/chat-input-operate/index.vue index 99a8a69c58b..b78d9caf494 100644 --- a/ui/src/components/ai-chat/component/chat-input-operate/index.vue +++ b/ui/src/components/ai-chat/component/chat-input-operate/index.vue @@ -1,7 +1,6 @@ @@ -60,6 +65,7 @@ const props = defineProps<{ type: 'log' | 'ai-chat' | 'debug-ai-chat' api_form_data: any form_data: any + first: boolean }>() // 用于刷新动态表单 const dynamicsFormRefresh = ref(0) @@ -67,7 +73,7 @@ const inputFieldList = ref([]) const apiInputFieldList = ref([]) const inputFieldConfig = ref({ title: t('chat.userInput') }) const showUserInput = ref(true) -const emit = defineEmits(['update:api_form_data', 'update:form_data']) +const emit = defineEmits(['update:api_form_data', 'update:form_data', 'confirm', 'cancel']) const api_form_data_context = computed({ get: () => { @@ -324,6 +330,14 @@ const decodeQuery = (query: string) => { return query } } +const confirmHandle = () => { + if (checkInputParam()) { + emit('confirm') + } +} +const cancelHandle = () => { + emit('cancel') +} defineExpose({ checkInputParam }) onMounted(() => { handleInputFieldList() diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index afeea39aad7..4035dbbff27 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -1,56 +1,76 @@