File tree Expand file tree Collapse file tree 1 file changed +26
-2
lines changed
ui/src/components/ai-chat/component/user-form Expand file tree Collapse file tree 1 file changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -286,18 +286,42 @@ const checkInputParam = () => {
286286 let msg = []
287287 for (let f of apiInputFieldList .value ) {
288288 if (! api_form_data_context .value [f .field ]) {
289- api_form_data_context .value [f .field ] = route .query [f .field ]
289+ let _value = route .query [f .field ]
290+ if (_value != null ) {
291+ if (_value instanceof Array ) {
292+ _value = _value
293+ .map ((item ) => {
294+ if (item != null ) {
295+ return decodeQuery (item )
296+ }
297+ return null
298+ })
299+ .filter ((item ) => item != null )
300+ } else {
301+ _value = decodeQuery (_value )
302+ }
303+ api_form_data_context .value [f .field ] = _value
304+ }
290305 }
291306 if (f .required && ! api_form_data_context .value [f .field ]) {
292307 msg .push (f .field )
293308 }
294309 }
295310 if (msg .length > 0 ) {
296- MsgWarning (` ${t (' chat.tip.inputParamMessage1' )} ${msg .join (' 、' )}${t (' chat.tip.inputParamMessage2' )} ` )
311+ MsgWarning (
312+ ` ${t (' chat.tip.inputParamMessage1' )} ${msg .join (' 、' )}${t (' chat.tip.inputParamMessage2' )} `
313+ )
297314 return false
298315 }
299316 return true
300317}
318+ const decodeQuery = (query : string ) => {
319+ try {
320+ return decodeURIComponent (query )
321+ } catch (e ) {
322+ return query
323+ }
324+ }
301325defineExpose ({ checkInputParam })
302326onMounted (() => {
303327 handleInputFieldList ()
You can’t perform that action at this time.
0 commit comments