Skip to content

Commit 9cd15a8

Browse files
fix: 【应用】问答页面用户提问时,只输入空格不能发送 (#121)
1 parent d16aaa4 commit 9cd15a8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ui/src/components/ai-chat/index.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ const chartOpenId = ref('')
217217
const chatList = ref<any[]>([])
218218
219219
const isDisabledChart = computed(
220-
() => !(inputValue.value && (props.appId || (props.data?.name && props.data?.model_id)))
220+
() => !(inputValue.value.trim() && (props.appId || (props.data?.name && props.data?.model_id)))
221221
)
222222
const isMdArray = (val: string) => val.match(/^-\s.*/m)
223223
const prologueList = computed(() => {
@@ -286,7 +286,9 @@ function sendChatHandle(event: any) {
286286
// 如果没有按下组合键ctrl,则会阻止默认事件
287287
event.preventDefault()
288288
if (!isDisabledChart.value && !loading.value && !event.isComposing) {
289-
chatMessage()
289+
if (inputValue.value.trim()) {
290+
chatMessage()
291+
}
290292
}
291293
} else {
292294
// 如果同时按下ctrl+回车键,则会换行
@@ -423,7 +425,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
423425
if (!chat) {
424426
chat = reactive({
425427
id: randomId(),
426-
problem_text: problem ? problem : inputValue.value,
428+
problem_text: problem ? problem : inputValue.value.trim(),
427429
answer_text: '',
428430
buffer: [],
429431
write_ed: false,

0 commit comments

Comments
 (0)