From f1cca660123dd639b3aa711486bd9564049e3328 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 24 Dec 2024 17:23:47 +0800 Subject: [PATCH] feat: add chat quick question --- .../ai-chat/component/chat-input-operate/index.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 7c90dbd7f..22c8ec222 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 @@ -189,7 +189,7 @@ import { MsgWarning } from '@/utils/message' const route = useRoute() const { - query: { mode } + query: { mode, question } } = route as any const quickInputRef = ref() const props = withDefaults( @@ -483,11 +483,11 @@ const handleTimeChange = () => { }, 1000) } -function sendChatHandle(event: any) { - if (!event.ctrlKey) { +function sendChatHandle(event?: any) { + if (!event?.ctrlKey) { // 如果没有按下组合键ctrl,则会阻止默认事件 - event.preventDefault() - if (!isDisabledChart.value && !props.loading && !event.isComposing) { + event?.preventDefault() + if (!isDisabledChart.value && !props.loading && !event?.isComposing) { if (inputValue.value.trim()) { props.sendMessage(inputValue.value, { image_list: uploadImageList.value, @@ -530,6 +530,10 @@ function mouseleave() { } onMounted(() => { + if (question) { + inputValue.value = decodeURIComponent(question.trim()) + sendChatHandle() + } setTimeout(() => { if (quickInputRef.value && mode === 'embed') { quickInputRef.value.textarea.style.height = '0'