feat: support tool multi-select input#29183
Conversation
Summary of ChangesHello @hjlarry, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for multi-select inputs across the Dify platform, specifically for tool parameters. It involves significant updates to both the backend's data models and validation logic to accommodate list-based values, as well as corresponding frontend changes to define, render, and manage these new multi-selection capabilities within the user interface. This enhancement provides greater flexibility in configuring tools and workflows. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for multi-select inputs in tools, a valuable feature enhancement. The changes are well-distributed across the Python backend and TypeScript frontend to handle list-based parameter values. The implementation is logical and covers the necessary modifications to data models and value handling. I have a couple of minor suggestions to improve code conciseness in the backend and type safety in the frontend.
This reverts commit 8225e3d.
There was a problem hiding this comment.
Pull request overview
This PR adds multi-select input support for tool parameters, enabling users to select multiple values from select and dynamic-select fields in workflow tool configurations. The implementation spans both frontend (TypeScript/React) and backend (Python), adding the ability to handle array values for tool parameters that have the multiple flag enabled.
Key Changes
- Extended type system to support list/array values for multi-select tool parameters
- Updated frontend variable type mapping to treat multi-select inputs as array types
- Modified backend validation to accept list values in constant-type tool parameters
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
web/app/components/workflow/nodes/_base/components/form-input-item.tsx |
Added logic to map multi-select inputs to VarType.array and filter for array variable types when isMultipleSelect is true |
web/app/components/header/account-setting/model-provider-page/declarations.ts |
Added optional multiple field to CredentialFormSchemaBase type definition |
api/core/workflow/nodes/tool/entities.py |
Extended constant type validation to accept list in addition to string, int, float, bool, and dict |
api/core/plugin/entities/parameters.py |
Added multiple field to PluginParameter model and updated cast_parameter_value to handle list values for SELECT/DYNAMIC_SELECT types |
Important
Fixes #<issue number>.Summary
to resolve #29180
depends on langgenius/dify-plugin-sdks#258
depends on langgenius/dify-plugin-daemon#523
Screenshots
test locally:
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods