feat: support bool type variable frontend (#24437)

Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com>
This commit is contained in:
Joel 2025-08-26 18:16:05 +08:00 • committed by GitHub
commit dac72b078d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
126 changed files with 3832 additions and 512 deletions

View file

@ -21,6 +21,7 @@ import { TEXT_GENERATION_TIMEOUT_MS } from '@/config'
import {
getFilesInLogs,
} from '@/app/components/base/file-uploader/utils'
import { formatBooleanInputs } from '@/utils/model-config'
export type IResultProps = {
isWorkflow: boolean
@ -124,7 +125,9 @@ const Result: FC<IResultProps> = ({
}
let hasEmptyInput = ''
const requiredVars = prompt_variables?.filter(({ key, name, required }) => {
const requiredVars = prompt_variables?.filter(({ key, name, required, type }) => {
if(type === 'boolean')
return false // boolean input is not required
const res = (!key || !key.trim()) || (!name || !name.trim()) || (required || required === undefined || required === null)
return res
}) || [] // compatible with old version
@ -158,7 +161,7 @@ const Result: FC<IResultProps> = ({
return
const data: Record<string, any> = {
inputs,
inputs: formatBooleanInputs(promptConfig?.prompt_variables, inputs),
}
if (visionConfig.enabled && completionFiles && completionFiles?.length > 0) {
data.files = completionFiles.map((item) => {