fix: handle potential undefined values in query_attachment_selector across multiple components (#29429)

This commit is contained in:
Wu Tianwei
2025-12-10 19:30:21 +08:00
committed by GitHub
parent ec3a52f012
commit 94244ed8f6
3 changed files with 8 additions and 7 deletions

View File

@@ -80,7 +80,7 @@ const useSingleRunFormParams = ({
},
]
if (hasMultiModalDatasets) {
const currentVariable = findVariableWhenOnLLMVision(payload.query_attachment_selector, availableFileVars)
const currentVariable = findVariableWhenOnLLMVision(payload.query_attachment_selector || [], availableFileVars)
inputFields.push(
{
inputs: [{
@@ -98,13 +98,13 @@ const useSingleRunFormParams = ({
}, [query, setQuery, t, datasetsDetail, payload.dataset_ids, payload.query_attachment_selector, availableFileVars, queryAttachment, setQueryAttachment])
const getDependentVars = () => {
return [payload.query_variable_selector, payload.query_attachment_selector]
return [payload.query_variable_selector, payload.query_attachment_selector || []]
}
const getDependentVar = (variable: string) => {
if (variable === 'query')
return payload.query_variable_selector
if (variable === 'queryAttachment')
return payload.query_attachment_selector
return payload.query_attachment_selector || []
}
return {