mirror of https://github.com/langgenius/dify.git
feat: hitl block
This commit is contained in:
parent
ab373197f9
commit
736ec55f86
|
|
@ -39,6 +39,11 @@ import {
|
|||
WorkflowVariableBlockNode,
|
||||
WorkflowVariableBlockReplacementBlock,
|
||||
} from './plugins/workflow-variable-block'
|
||||
import {
|
||||
HITLInputBlock,
|
||||
HITLInputBlockReplacementBlock,
|
||||
HITLInputNode,
|
||||
} from './plugins/hitl-input-block'
|
||||
import VariableBlock from './plugins/variable-block'
|
||||
import VariableValueBlock from './plugins/variable-value-block'
|
||||
import { VariableValueBlockNode } from './plugins/variable-value-block/node'
|
||||
|
|
@ -49,6 +54,7 @@ import { textToEditorState } from './utils'
|
|||
import type {
|
||||
ContextBlockType,
|
||||
ExternalToolBlockType,
|
||||
HITLInputBlockType,
|
||||
HistoryBlockType,
|
||||
QueryBlockType,
|
||||
VariableBlockType,
|
||||
|
|
@ -80,6 +86,7 @@ export type PromptEditorProps = {
|
|||
variableBlock?: VariableBlockType
|
||||
externalToolBlock?: ExternalToolBlockType
|
||||
workflowVariableBlock?: WorkflowVariableBlockType
|
||||
hitlInputBlock?: HITLInputBlockType
|
||||
isSupportFileVar?: boolean
|
||||
}
|
||||
|
||||
|
|
@ -102,6 +109,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
|||
variableBlock,
|
||||
externalToolBlock,
|
||||
workflowVariableBlock,
|
||||
hitlInputBlock,
|
||||
isSupportFileVar,
|
||||
}) => {
|
||||
const { eventEmitter } = useEventEmitterContextContext()
|
||||
|
|
@ -119,6 +127,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
|||
QueryBlockNode,
|
||||
WorkflowVariableBlockNode,
|
||||
VariableValueBlockNode,
|
||||
HITLInputNode,
|
||||
],
|
||||
editorState: textToEditorState(value || ''),
|
||||
onError: (error: Error) => {
|
||||
|
|
@ -230,6 +239,15 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
|||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
// TODO: test hitlInputBlock?.show
|
||||
(
|
||||
<>
|
||||
<HITLInputBlock />
|
||||
<HITLInputBlockReplacementBlock />
|
||||
</>
|
||||
)
|
||||
}
|
||||
<OnChangePlugin onChange={handleEditorChange} />
|
||||
<OnBlurBlock onBlur={onBlur} onFocus={onFocus} />
|
||||
<UpdateBlock instanceId={instanceId} />
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ export type WorkflowVariableBlockType = {
|
|||
getVarType?: GetVarType
|
||||
}
|
||||
|
||||
export type HITLInputBlockType = {
|
||||
show?: boolean
|
||||
}
|
||||
|
||||
export type MenuTextMatch = {
|
||||
leadOffset: number
|
||||
matchingString: string
|
||||
|
|
|
|||
|
|
@ -255,6 +255,9 @@ export const VAR_REGEX = /\{\{(#[a-zA-Z0-9_-]{1,50}(\.[a-zA-Z_]\w{0,29}){1,10}#)
|
|||
|
||||
export const resetReg = () => VAR_REGEX.lastIndex = 0
|
||||
|
||||
export const HITL_INPUT_REG = /\{\{#$output\.([a-zA-Z_]\w{0,29}){1,10}#\}\}/gi
|
||||
export const resetHITLInputReg = () => HITL_INPUT_REG.lastIndex = 0
|
||||
|
||||
export const DISABLE_UPLOAD_IMAGE_AS_ICON = process.env.NEXT_PUBLIC_DISABLE_UPLOAD_IMAGE_AS_ICON === 'true'
|
||||
|
||||
export const GITHUB_ACCESS_TOKEN = process.env.NEXT_PUBLIC_GITHUB_ACCESS_TOKEN || ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue