-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add user select node (#2300) * feat: add user select node * fix * type * fix * fix * fix * perf: user select code * perf: user select histories * perf: i18n --------- Co-authored-by: heheer <[email protected]>
- Loading branch information
1 parent
f8b8fcc
commit fdeb159
Showing
51 changed files
with
1,056 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
packages/global/core/workflow/template/system/userSelect/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { i18nT } from '../../../../../../web/i18n/utils'; | ||
import { | ||
FlowNodeTemplateTypeEnum, | ||
NodeInputKeyEnum, | ||
NodeOutputKeyEnum, | ||
WorkflowIOValueTypeEnum | ||
} from '../../../constants'; | ||
import { | ||
FlowNodeInputTypeEnum, | ||
FlowNodeOutputTypeEnum, | ||
FlowNodeTypeEnum | ||
} from '../../../node/constant'; | ||
import { FlowNodeTemplateType } from '../../../type/node.d'; | ||
import { getHandleConfig } from '../../utils'; | ||
|
||
export const UserSelectNode: FlowNodeTemplateType = { | ||
id: FlowNodeTypeEnum.userSelect, | ||
templateType: FlowNodeTemplateTypeEnum.interactive, | ||
flowNodeType: FlowNodeTypeEnum.userSelect, | ||
sourceHandle: getHandleConfig(false, false, false, false), | ||
targetHandle: getHandleConfig(true, false, true, true), | ||
avatar: 'core/workflow/template/userSelect', | ||
diagram: '/imgs/app/userSelect.svg', | ||
name: i18nT('app:workflow.user_select'), | ||
intro: i18nT(`app:workflow.user_select_tip`), | ||
showStatus: true, | ||
version: '489', | ||
inputs: [ | ||
{ | ||
key: NodeInputKeyEnum.description, | ||
renderTypeList: [FlowNodeInputTypeEnum.textarea], | ||
valueType: WorkflowIOValueTypeEnum.string, | ||
label: i18nT('app:workflow.select_description') | ||
}, | ||
{ | ||
key: NodeInputKeyEnum.userSelectOptions, | ||
renderTypeList: [FlowNodeInputTypeEnum.custom], | ||
valueType: WorkflowIOValueTypeEnum.any, | ||
label: '', | ||
value: [ | ||
{ | ||
value: 'Confirm', | ||
key: 'option1' | ||
}, | ||
{ | ||
value: 'Cancel', | ||
key: 'option2' | ||
} | ||
] | ||
} | ||
], | ||
outputs: [ | ||
{ | ||
id: NodeOutputKeyEnum.selectResult, | ||
key: NodeOutputKeyEnum.selectResult, | ||
required: true, | ||
label: i18nT('app:workflow.select_result'), | ||
valueType: WorkflowIOValueTypeEnum.string, | ||
type: FlowNodeOutputTypeEnum.static | ||
} | ||
] | ||
}; |
26 changes: 26 additions & 0 deletions
26
packages/global/core/workflow/template/system/userSelect/type.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NodeOutputItemType } from '../../../../chat/type'; | ||
import { FlowNodeOutputItemType } from '../../../type/io'; | ||
import { RuntimeEdgeItemType } from '../../../runtime/type'; | ||
|
||
export type UserSelectOptionItemType = { | ||
key: string; | ||
value: string; | ||
}; | ||
|
||
type InteractiveBasicType = { | ||
entryNodeIds: string[]; | ||
memoryEdges: RuntimeEdgeItemType[]; | ||
nodeOutputs: NodeOutputItemType[]; | ||
}; | ||
type UserSelectInteractive = { | ||
type: 'userSelect'; | ||
params: { | ||
// description: string; | ||
userSelectOptions: UserSelectOptionItemType[]; | ||
userSelectedVal?: string; | ||
}; | ||
}; | ||
|
||
export type InteractiveNodeResponseItemType = InteractiveBasicType & UserSelectInteractive; | ||
|
||
export type UserInteractiveType = UserSelectInteractive; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.