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 36a157f0b7..8a7cf89ac3 100644 --- a/web/app/components/share/text-generation/run-once/index.tsx +++ b/web/app/components/share/text-generation/run-once/index.tsx @@ -19,6 +19,8 @@ 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' +import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' +import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' export type IRunOnceProps = { siteInfo: SiteInfo @@ -149,6 +151,18 @@ const RunOnce: FC = ({ }} /> )} + {item.type === 'json_object' && ( + { handleInputsChange({ ...inputsRef.current, [item.key]: value }) }} + noWrapper + className='bg h-[80px] overflow-y-auto rounded-[10px] bg-components-input-bg-normal p-1' + placeholder={ +
{item.json_schema}
+ } + /> + )} ))} diff --git a/web/models/debug.ts b/web/models/debug.ts index 0a1c9c8a23..630c48a970 100644 --- a/web/models/debug.ts +++ b/web/models/debug.ts @@ -60,6 +60,7 @@ export type PromptVariable = { icon?: string icon_background?: string hide?: boolean // used in frontend to hide variable + json_schema?: string } export type CompletionParams = { diff --git a/web/utils/model-config.ts b/web/utils/model-config.ts index c4c87e4ffe..7ef05e1e7a 100644 --- a/web/utils/model-config.ts +++ b/web/utils/model-config.ts @@ -30,6 +30,9 @@ export const userInputsFormToPromptVariables = (useInputs: UserInputFormItem[] | if (item.external_data_tool) return [item.external_data_tool.type, item.external_data_tool] + if (item.json_object) + return ['json_object', item.json_object] + return ['select', item.select || {}] })() const is_context_var = dataset_query_variable === content?.variable