Feat/add param dynamic tree select#725
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the DYNAMIC_TREE_SELECT parameter type for agent strategies, tools, and triggers, while adding a Parent field to dynamic parameter select requests. The ParameterOption struct now supports hierarchical data via a recursive Children field. Feedback points out that EventParameterOption in trigger_declaration.go lacks a similar Children field, creating an inconsistency that prevents triggers from supporting hierarchical options.
| EVENT_PARAMETER_TYPE_DYNAMIC_SELECT EventParameterType = DYNAMIC_SELECT | ||
| EVENT_PARAMETER_TYPE_CHECKBOX EventParameterType = CHECKBOX | ||
| EVENT_PARAMETER_TYPE_DYNAMIC_SELECT EventParameterType = DYNAMIC_SELECT | ||
| EVENT_PARAMETER_TYPE_DYNAMIC_TREE_SELECT EventParameterType = DYNAMIC_TREE_SELECT |
There was a problem hiding this comment.
The dynamic-tree-select parameter type is being added to triggers, but the EventParameterOption struct (defined earlier in this file and used by EventParameter.Options) has not been updated to include a Children field. This is inconsistent with the changes made to ParameterOption in constant.go, which now supports hierarchy for tools and agent strategies. To ensure triggers can also support hierarchical options in their declarations, EventParameterOption should be updated to include a recursive Children field.
Description
Add
dynamic-tree-selectparameter type support to the plugin daemon, enabling tool/trigger/agent-strategy parameters to render hierarchical tree-structured options with dynamic loading. This is the plugin-daemon counterpart of the Dify main repo change in #35837.Fixes langgenius/dify#35837
Type of Change
Essential Checklist
Testing
Bug Fix (if applicable)
Fixes #123orCloses #123)Additional Information
Changes
pkg/entities/plugin_entities/constant.go— AddDYNAMIC_TREE_SELECT = "dynamic-tree-select"constant andChildren []ParameterOptionfield toParameterOptionstruct for hierarchical data supportpkg/entities/plugin_entities/tool_declaration.go— AddTOOL_PARAMETER_TYPE_DYNAMIC_TREE_SELECTconstant and register it inisToolParameterTypevalidatorpkg/entities/plugin_entities/trigger_declaration.go— AddEVENT_PARAMETER_TYPE_DYNAMIC_TREE_SELECTconstant and register it inisEventParameterTypevalidatorpkg/entities/plugin_entities/agent_declaration.go— AddAGENT_STRATEGY_PARAMETER_TYPE_DYNAMIC_TREE_SELECTconstant and register it inisAgentStrategyParameterTypevalidatorpkg/entities/requests/dynamic_select.go— AddParent *stringfield toRequestDynamicParameterSelectfor lazy-loading child nodesKey design
dynamic-tree-selecttype extends the existingdynamic-selectpattern by adding achildrenfield toParameterOption, enabling recursive tree structuresparentfield in the request allows plugins to implement lazy-loading of child nodes on demand