Skip to content

Commit 9c36d8f

Browse files
authored
fix: Quick issue, API parameters cannot be carried (#2808)
1 parent 189e2a6 commit 9c36d8f

File tree

1 file changed

+16
-11
lines changed
  • ui/src/components/ai-chat/component/user-form

1 file changed

+16
-11
lines changed

ui/src/components/ai-chat/component/user-form/index.vue

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -326,31 +326,35 @@ const checkInputParam = () => {
326326
}
327327
// 浏览器query参数找到接口传参
328328
let msg = []
329+
for (let f of apiInputFieldList.value) {
330+
if (f.required && !api_form_data_context.value[f.field]) {
331+
msg.push(f.field)
332+
}
333+
}
334+
335+
if (msg.length > 0) {
336+
MsgWarning(
337+
`${t('chat.tip.inputParamMessage1')} ${msg.join('')}${t('chat.tip.inputParamMessage2')}`
338+
)
339+
return false
340+
}
341+
return true
342+
}
343+
const initRouteQueryValue = () => {
329344
for (let f of apiInputFieldList.value) {
330345
if (!api_form_data_context.value[f.field]) {
331346
let _value = getRouteQueryValue(f.field)
332347
if (_value != null) {
333348
api_form_data_context.value[f.field] = _value
334349
}
335350
}
336-
if (f.required && !api_form_data_context.value[f.field]) {
337-
msg.push(f.field)
338-
}
339351
}
340352
if (!api_form_data_context.value['asker']) {
341353
const asker = getRouteQueryValue('asker')
342354
if (asker) {
343355
api_form_data_context.value['asker'] = getRouteQueryValue('asker')
344356
}
345357
}
346-
347-
if (msg.length > 0) {
348-
MsgWarning(
349-
`${t('chat.tip.inputParamMessage1')} ${msg.join('')}${t('chat.tip.inputParamMessage2')}`
350-
)
351-
return false
352-
}
353-
return true
354358
}
355359
const decodeQuery = (query: string) => {
356360
try {
@@ -383,6 +387,7 @@ defineExpose({ checkInputParam, render, renderDebugAiChat })
383387
onMounted(() => {
384388
firstMounted.value = true
385389
handleInputFieldList()
390+
initRouteQueryValue()
386391
})
387392
</script>
388393
<style lang="scss" scoped>

0 commit comments

Comments
 (0)