|
23 | 23 | ref="userFormRef" |
24 | 24 | ></UserForm> |
25 | 25 | </div> |
26 | | - <template v-if="!isUserInput || !firsUserInput || type === 'log'"> |
| 26 | + <template v-if="!(isUserInput || isAPIInput) || !firsUserInput || type === 'log'"> |
27 | 27 | <el-scrollbar ref="scrollDiv" @scroll="handleScrollTop"> |
28 | 28 | <div ref="dialogScrollbar" class="ai-chat__content p-16"> |
29 | 29 | <PrologueContent |
|
80 | 80 | </slot> |
81 | 81 |
|
82 | 82 | <el-button |
83 | | - v-if="isUserInput" |
| 83 | + v-if="isUserInput || isAPIInput" |
84 | 84 | class="user-input-button mb-8" |
85 | 85 | type="primary" |
86 | 86 | text |
@@ -115,6 +115,7 @@ import UserForm from '@/components/ai-chat/component/user-form/index.vue' |
115 | 115 | import Control from '@/components/ai-chat/component/control/index.vue' |
116 | 116 | import { t } from '@/locales' |
117 | 117 | import bus from '@/bus' |
| 118 | +import { fa } from 'element-plus/es/locale' |
118 | 119 | const transcribing = ref<boolean>(false) |
119 | 120 | defineOptions({ name: 'AiChat' }) |
120 | 121 | const route = useRoute() |
@@ -162,13 +163,19 @@ const initialApiFormData = ref({}) |
162 | 163 | const isUserInput = computed( |
163 | 164 | () => |
164 | 165 | 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 |
169 | 173 | ) |
170 | 174 | 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 | + ) |
172 | 179 | }) |
173 | 180 | watch( |
174 | 181 | () => props.chatId, |
@@ -241,15 +248,22 @@ function sendMessage(val: string, other_params_data?: any, chat?: chatType): Pro |
241 | 248 | return result |
242 | 249 | }, {}) |
243 | 250 | localStorage.setItem(`${accessToken}userForm`, JSON.stringify(newData)) |
| 251 | +
|
244 | 252 | showUserInput.value = false |
| 253 | +
|
245 | 254 | if (!loading.value && props.applicationDetails?.name) { |
246 | 255 | handleDebounceClick(val, other_params_data, chat) |
247 | 256 | return true |
248 | 257 | } |
249 | 258 | throw 'err: no send' |
250 | 259 | }) |
251 | 260 | .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 | +
|
253 | 267 | return false |
254 | 268 | }) |
255 | 269 | } else { |
|
0 commit comments