fix: 【应用】问答页面用户提问时,只输入空格不能发送 (#121)

This commit is contained in:
wangdan-fit2cloud 2024-04-16 16:56:19 +08:00 committed by GitHub
parent d16aaa4597
commit 9cd15a8894
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -217,7 +217,7 @@ const chartOpenId = ref('')
const chatList = ref<any[]>([]) const chatList = ref<any[]>([])
const isDisabledChart = computed( const isDisabledChart = computed(
() => !(inputValue.value && (props.appId || (props.data?.name && props.data?.model_id))) () => !(inputValue.value.trim() && (props.appId || (props.data?.name && props.data?.model_id)))
) )
const isMdArray = (val: string) => val.match(/^-\s.*/m) const isMdArray = (val: string) => val.match(/^-\s.*/m)
const prologueList = computed(() => { const prologueList = computed(() => {
@ -286,8 +286,10 @@ function sendChatHandle(event: any) {
// ctrl // ctrl
event.preventDefault() event.preventDefault()
if (!isDisabledChart.value && !loading.value && !event.isComposing) { if (!isDisabledChart.value && !loading.value && !event.isComposing) {
if (inputValue.value.trim()) {
chatMessage() chatMessage()
} }
}
} else { } else {
// ctrl+ // ctrl+
inputValue.value += '\n' inputValue.value += '\n'
@ -423,7 +425,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean) {
if (!chat) { if (!chat) {
chat = reactive({ chat = reactive({
id: randomId(), id: randomId(),
problem_text: problem ? problem : inputValue.value, problem_text: problem ? problem : inputValue.value.trim(),
answer_text: '', answer_text: '',
buffer: [], buffer: [],
write_ed: false, write_ed: false,