Skip to content

Commit df7f922

Browse files
fix: fix api input bug
1 parent a054120 commit df7f922

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

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

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ref="userFormRef"
2424
></UserForm>
2525
</div>
26-
<template v-if="!isUserInput || !firsUserInput || type === 'log'">
26+
<template v-if="!(isUserInput || isAPIInput) || !firsUserInput || type === 'log'">
2727
<el-scrollbar ref="scrollDiv" @scroll="handleScrollTop">
2828
<div ref="dialogScrollbar" class="ai-chat__content p-16">
2929
<PrologueContent
@@ -80,7 +80,7 @@
8080
</slot>
8181

8282
<el-button
83-
v-if="isUserInput"
83+
v-if="isUserInput || isAPIInput"
8484
class="user-input-button mb-8"
8585
type="primary"
8686
text
@@ -115,6 +115,7 @@ import UserForm from '@/components/ai-chat/component/user-form/index.vue'
115115
import Control from '@/components/ai-chat/component/control/index.vue'
116116
import { t } from '@/locales'
117117
import bus from '@/bus'
118+
import { fa } from 'element-plus/es/locale'
118119
const transcribing = ref<boolean>(false)
119120
defineOptions({ name: 'AiChat' })
120121
const route = useRoute()
@@ -162,13 +163,19 @@ const initialApiFormData = ref({})
162163
const isUserInput = computed(
163164
() =>
164165
props.applicationDetails.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')[0]
165-
.properties.user_input_field_list.length > 0 ||
166-
(props.type === 'debug-ai-chat' &&
167-
props.applicationDetails.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')[0]
168-
.properties.api_input_field_list.length > 0)
166+
.properties.user_input_field_list.length > 0
167+
)
168+
const isAPIInput = computed(
169+
() =>
170+
props.type === 'debug-ai-chat' &&
171+
props.applicationDetails.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')[0]
172+
.properties.api_input_field_list.length > 0
169173
)
170174
const showUserInputContent = computed(() => {
171-
return ((isUserInput.value && firsUserInput.value) || showUserInput.value) && props.type !== 'log'
175+
return (
176+
(((isUserInput.value || isAPIInput) && firsUserInput.value) || showUserInput.value) &&
177+
props.type !== 'log'
178+
)
172179
})
173180
watch(
174181
() => props.chatId,
@@ -241,15 +248,22 @@ function sendMessage(val: string, other_params_data?: any, chat?: chatType): Pro
241248
return result
242249
}, {})
243250
localStorage.setItem(`${accessToken}userForm`, JSON.stringify(newData))
251+
244252
showUserInput.value = false
253+
245254
if (!loading.value && props.applicationDetails?.name) {
246255
handleDebounceClick(val, other_params_data, chat)
247256
return true
248257
}
249258
throw 'err: no send'
250259
})
251260
.catch((e) => {
252-
showUserInput.value = true
261+
if (isAPIInput.value && props.type !== 'debug-ai-chat') {
262+
showUserInput.value = false
263+
} else {
264+
showUserInput.value = true
265+
}
266+
253267
return false
254268
})
255269
} else {

0 commit comments

Comments
 (0)