Skip to content

Commit f1cca66

Browse files
feat: add chat quick question
1 parent af3266b commit f1cca66

File tree

1 file changed

+9
-5
lines changed
  • ui/src/components/ai-chat/component/chat-input-operate

1 file changed

+9
-5
lines changed

ui/src/components/ai-chat/component/chat-input-operate/index.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ import { MsgWarning } from '@/utils/message'
189189
190190
const route = useRoute()
191191
const {
192-
query: { mode }
192+
query: { mode, question }
193193
} = route as any
194194
const quickInputRef = ref()
195195
const props = withDefaults(
@@ -483,11 +483,11 @@ const handleTimeChange = () => {
483483
}, 1000)
484484
}
485485
486-
function sendChatHandle(event: any) {
487-
if (!event.ctrlKey) {
486+
function sendChatHandle(event?: any) {
487+
if (!event?.ctrlKey) {
488488
// 如果没有按下组合键ctrl,则会阻止默认事件
489-
event.preventDefault()
490-
if (!isDisabledChart.value && !props.loading && !event.isComposing) {
489+
event?.preventDefault()
490+
if (!isDisabledChart.value && !props.loading && !event?.isComposing) {
491491
if (inputValue.value.trim()) {
492492
props.sendMessage(inputValue.value, {
493493
image_list: uploadImageList.value,
@@ -530,6 +530,10 @@ function mouseleave() {
530530
}
531531
532532
onMounted(() => {
533+
if (question) {
534+
inputValue.value = decodeURIComponent(question.trim())
535+
sendChatHandle()
536+
}
533537
setTimeout(() => {
534538
if (quickInputRef.value && mode === 'embed') {
535539
quickInputRef.value.textarea.style.height = '0'

0 commit comments

Comments
 (0)