Skip to content

feat: Add default value support for all workflow start node variable types#24129

Merged
crazywoola merged 7 commits intolanggenius:mainfrom
17hz:feat/var-default-value
Aug 22, 2025
Merged

feat: Add default value support for all workflow start node variable types#24129
crazywoola merged 7 commits intolanggenius:mainfrom
17hz:feat/var-default-value

Conversation

@17hz
Copy link
Copy Markdown
Contributor

@17hz 17hz commented Aug 18, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

This PR implements default value configuration support for all applicable field types in workflow start node variables, extending the existing dropdown default value functionality to text input, paragraph, select, number, and file upload fields.

Fixes #11290
Fixes #21192
Fixes #23428

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

@17hz 17hz marked this pull request as ready for review August 19, 2025 11:09
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. 🌊 feat:workflow Workflow related stuff. labels Aug 19, 2025
@crazywoola crazywoola requested a review from Copilot August 21, 2025 11:59
@crazywoola crazywoola self-assigned this Aug 21, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements default value support for all workflow start node variable types by extending the existing dropdown default value functionality to text input, paragraph, select, number, and file upload fields. This addresses multiple user requests for enhanced workflow configuration capabilities.

Key changes include:

  • Adding default value configuration UI for text, paragraph, number, and file upload field types
  • Updating form initialization logic to properly handle default values across all variable types
  • Modifying the inputs panel to use default values when initializing workflow variables

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web/utils/model-config.ts Adds default value mapping for text, number, and file upload types
web/app/components/workflow/panel/inputs-panel.tsx Refactors input initialization to use default values directly
web/app/components/share/text-generation/run-once/index.tsx Extends default value support to shared workflow execution
web/app/components/base/chat/embedded-chatbot/hooks.tsx Updates embedded chatbot to handle multiple default value sources
web/app/components/base/chat/chat-with-history/hooks.tsx Updates chat history component to handle multiple default value sources
web/app/components/app/configuration/config-var/config-modal/index.tsx Adds UI components for configuring default values for all field types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@crazywoola
Copy link
Copy Markdown
Member

crazywoola commented Aug 21, 2025

Please take a look at these comments. The function is working as expected.

@17hz
Copy link
Copy Markdown
Contributor Author

17hz commented Aug 21, 2025

Thank you for the review! I've reviewed the comments and the function is indeed working correctly

@crazywoola
Copy link
Copy Markdown
Member

Please resolve those comments if you think those are unnecessary. :)

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 22, 2025
@17hz
Copy link
Copy Markdown
Contributor Author

17hz commented Aug 22, 2025

done !

@crazywoola crazywoola merged commit ffe1685 into langgenius:main Aug 22, 2025
6 checks passed
Gnomeek added a commit to Gnomeek/dify that referenced this pull request Aug 22, 2025
ci

add assertion

docs: format all md files (langgenius#24195)

Signed-off-by: yihong0618 <[email protected]>

hotfix: fix multiple case match syntax (langgenius#24204)

feat: notice of the expire of education verify (langgenius#24210)

Co-authored-by: Copilot <[email protected]>

Feat: Education (langgenius#24208)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

chore: translate i18n files (langgenius#24211)

Co-authored-by: iamjoel <[email protected]>

Httpx example (langgenius#24151)

add tyck tool (currently ignore the error) (langgenius#22592)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Fix the bug of automatically appending basepath to image resource. (langgenius#24201)

fix: keep idempotent when init AnalyticdbVectorBySql (langgenius#24239)

Co-authored-by: xiaozeyu <[email protected]>

fix: dataset doc-form compatible (langgenius#24177)

Co-authored-by: huangzhuo <[email protected]>

feature: add test containers base tests for saved message service (langgenius#24259)

Mcp support resource discovery (langgenius#24223)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

fix: loop exit condition accepts variables from nodes inside the loop  langgenius#24183: (langgenius#24257)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

feat: show the start time with seconds of the app logs (langgenius#24267)

fix(api):Fix the issue of empty and not empty operations failing in k… (langgenius#24276)

Co-authored-by: liumin <[email protected]>

fix: rollback when AnalyticDB create zhparser failed (langgenius#24260)

Co-authored-by: xiaozeyu <[email protected]>

fix: value_type check failed when updating variables (langgenius#24274)

Co-authored-by: me <[email protected]>

[Test] add unit tests for ProviderConfigEncrypter encrypt/mask/decrypt (langgenius#24280)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

refactor: replace try-except blocks with contextlib.suppress for cleaner exception handling (langgenius#24284)

style: replace `h-[1px]` with `h-px` to unify the writing format of Tailwind CSS (langgenius#24146)

Fix: safe defaults for BaseModel dict fields (langgenius#24098)

Co-authored-by: Yongtao Huang <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

[CHORE]: x: T = None to x: Optional[T] = None (langgenius#24217)

feature: add test containers base tests for tag service (langgenius#24313)

[Test] add unit tests for web_reader_tool.py (langgenius#24309)

Co-authored-by: Yongtao Huang <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Annotations example (langgenius#24304)

an example of sessionmaker (langgenius#24246)

feat: implement TooltipManager for managing tooltip lifecycle (langgenius#24236)

Co-authored-by: crazywoola <[email protected]>

Flask 3.1.2 upgrade fix by Avoids using current_user in background thread  (langgenius#24290)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

fix: Optimize scrolling experience on plugin page (langgenius#24314) (langgenius#24322)

auto format md files (langgenius#24242)

Feat/chat message image first for agent and advanced_chat APP (langgenius#23796)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

Update knowledge_retrieval_node.py (langgenius#24111)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

example of next(, None) (langgenius#24345)

feat: Add default value support for all workflow start node variable types (langgenius#24129)

Co-authored-by: crazywoola <[email protected]>
Co-authored-by: Copilot <[email protected]>

refactor: simplify repository factory with Django-style import_string (langgenius#24354)

Fix missing database commit in provider update handler (langgenius#24357)

Node search supports model and name search (langgenius#24331)

[Chore/Refactor] except StopIteration -> next( , None)
qiaofenlin pushed a commit to qiaofenlin/dify that referenced this pull request Aug 24, 2025
ZeroZ-lab pushed a commit to ZeroZ-lab/dify that referenced this pull request Aug 25, 2025
qiqizjl pushed a commit to qiqizjl/dify that referenced this pull request Aug 27, 2025
HarryReidx pushed a commit to HarryReidx/dify that referenced this pull request Sep 1, 2025
…types (langgenius#24129)

Co-authored-by: crazywoola <[email protected]>
Co-authored-by: Copilot <[email protected]>
(cherry picked from commit ffe1685)
@17hz 17hz deleted the feat/var-default-value branch September 3, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌊 feat:workflow Workflow related stuff. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input default values Add default values to user-defined input field

3 participants