mirror of
https://github.com/langgenius/dify.git
synced 2026-03-26 05:29:50 +08:00
feat: workflow support input json
This commit is contained in:
parent
a1f278bdc8
commit
e38ba8403d
@ -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<IRunOnceProps> = ({
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{item.type === 'json_object' && (
|
||||
<CodeEditor
|
||||
language={CodeLanguage.json}
|
||||
value={inputs[item.key]}
|
||||
onChange={(value) => { handleInputsChange({ ...inputsRef.current, [item.key]: value }) }}
|
||||
noWrapper
|
||||
className='bg h-[80px] overflow-y-auto rounded-[10px] bg-components-input-bg-normal p-1'
|
||||
placeholder={
|
||||
<div className='whitespace-pre'>{item.json_schema}</div>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user