From 912d68a148be72c8f9f573c4c9c9f2cf06d8e7d1 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 9 Jul 2025 14:56:11 +0800 Subject: [PATCH] chore: competion webapp --- .../share/text-generation/result/index.tsx | 7 +++++-- .../share/text-generation/run-once/index.tsx | 15 +++++++++++++-- web/utils/model-config.ts | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx index 97a3a77395..fc5422589c 100644 --- a/web/app/components/share/text-generation/result/index.tsx +++ b/web/app/components/share/text-generation/result/index.tsx @@ -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 = ({ } 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 = ({ return const data: Record = { - inputs, + inputs: formatBooleanInputs(promptConfig?.prompt_variables, inputs), } if (visionConfig.enabled && completionFiles && completionFiles?.length > 0) { data.files = completionFiles.map((item) => { diff --git a/web/app/components/share/text-generation/run-once/index.tsx b/web/app/components/share/text-generation/run-once/index.tsx index 546b21d2b0..65ce8b28ab 100644 --- a/web/app/components/share/text-generation/run-once/index.tsx +++ b/web/app/components/share/text-generation/run-once/index.tsx @@ -18,6 +18,7 @@ import { FileUploaderInAttachmentWrapper } from '@/app/components/base/file-uplo import { getProcessedFiles } from '@/app/components/base/file-uploader/utils' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import cn from '@/utils/classnames' +import BoolInput from '@/app/components/workflow/nodes/_base/components/before-run-form/bool-input' export type IRunOnceProps = { siteInfo: SiteInfo @@ -82,7 +83,9 @@ const RunOnce: FC = ({ {(inputs === null || inputs === undefined || Object.keys(inputs).length === 0) ? null : promptConfig.prompt_variables.map(item => (
- + {item.type !== 'boolean' && ( + + )}
{item.type === 'select' && (