diff --git a/ui/src/assets/window3.png b/ui/src/assets/window3.png new file mode 100644 index 00000000000..4c2a3a563f2 Binary files /dev/null and b/ui/src/assets/window3.png differ 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 b78d9caf494..14e185a6996 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 @@ -525,8 +525,8 @@ function autoSendMessage() { } function sendChatHandle(event?: any) { - if (!event?.ctrlKey) { - // 如果没有按下组合键ctrl,则会阻止默认事件 + if (!event?.ctrlKey && !event?.shiftKey && !event?.altKey && !event?.metaKey) { + // 如果没有按下组合键,则会阻止默认事件 event?.preventDefault() if (!isDisabledChat.value && !props.loading && !event?.isComposing) { if (inputValue.value.trim()) { @@ -534,14 +534,16 @@ function sendChatHandle(event?: any) { } } } else { - // 如果同时按下ctrl+回车键,则会换行 - insertNewlineAtCursor() + // 如果同时按下ctrl/shift/cmd/opt +enter,则会换行 + insertNewlineAtCursor(event) } } -const insertNewlineAtCursor = () => { +const insertNewlineAtCursor = (event?: any) => { const textarea = document.querySelector('.el-textarea__inner') as HTMLTextAreaElement const startPos = textarea.selectionStart const endPos = textarea.selectionEnd + // 阻止默认行为(避免额外的换行符) + event.preventDefault() // 在光标处插入换行符 inputValue.value = inputValue.value.slice(0, startPos) + '\n' + inputValue.value.slice(endPos) nextTick(() => { diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 6174e18bbfd..24e8c71ec48 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -1,7 +1,7 @@