Skip to content

feat: add tool plugin param type date and date-picker - #36163

Merged
WH-2099 merged 16 commits into
langgenius:mainfrom
zyqzyq:feat/add_param_data_picker
Aug 10, 2026
Merged

feat: add tool plugin param type date and date-picker#36163
WH-2099 merged 16 commits into
langgenius:mainfrom
zyqzyq:feat/add_param_data_picker

Conversation

@zyqzyq

@zyqzyq zyqzyq commented May 14, 2026

Copy link
Copy Markdown
Contributor

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>.

Fixes #36162

Summary

This change adds first-class support for date and date-picker tool/plugin parameter types end to end: schema normalization, backend typing/casting, workflow UI (tool node, variable picker, constant field, trigger form), plugin reasoning configuration, and i18n. Values for date are handled as a single calendar day (string); date-picker represents an optional start/end range serialized as a JSON string/object consistent with backend casting.

Backend

  • Extended CommonParameterType with DATE and DATE_PICKER (api/core/entities/parameter_entities.py).
  • Wired PluginParameterType / ToolParameterType and cast_parameter_value / as_normal_type logic for date and date-picker (api/core/plugin/entities/parameters.py, api/core/tools/entities/tool_entities.py).
  • Added unit coverage for enum values and date-picker casting edge cases (api/tests/unit_tests/core/entities/test_entities_parameter_entities.py).

Frontend

  • Added FormTypeEnum.date and FormTypeEnum.datePicker (declarations.ts) and schema mapping in to-form-schema.ts (including aliases such as datepickerdate-picker).
  • Centralized declarative type matching via toolDeclarativeTypeMatches in form-input-item.helpers.ts (used by form input, variable picker, reasoning config, and input variable list).
  • Tool / trigger forms: form-input-item.tsx renders a native date input for date and ToolDateRangePicker for date-picker (timezone from app context). constant-field.tsx, input-var-list.tsx, tool-form/item.tsx, and trigger-plugin/.../trigger-form/item.tsx updated for labels, tooltips, and picker behavior.
  • Variable reference UX: var-reference-picker.tsx / var-reference-picker.trigger.tsx force constant mode for date-picker and hide the mixed constant/variable type switch where inappropriate.
  • Plugin reasoning panel: reasoning-config-form.tsx + reasoning-config-form.helpers.ts aligned with the same types, filters, and ToolDateRangePicker.
  • New UI pieces: tool-date-range-picker.tsx, tool-date-range-value.ts (parse/stringify range payload); cn from @langgenius/dify-ui/cn for bundler compatibility.
  • i18n: nodes.tool.dateRange.* in web/i18n/en-US/workflow.json and web/i18n/zh-Hans/workflow.json.
  • Tests: form-input-item.helpers.spec.ts, reasoning-config-form.helpers.spec.ts for declarative matching and date / date-picker behavior.

Screenshots

Before After
Tool parameters typed as date / date-picker in provider YAML were not rendered with dedicated controls in the workflow tool node and related pickers. Native date control and start/end range picker for date-picker, with correct variable filtering and constant-only behavior where required.

(Replace the table cells with embedded images if you attach screenshots in the PR.)

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 make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. javascript labels May 14, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 14, 2026
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-06 08:07:59.249481843 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-06 08:07:45.545250846 +0000
@@ -423,7 +423,7 @@
 ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `tidb_serverless_list` with type `Sequence[TidbAuthBinding]` in function `dify_vdb_tidb_on_qdrant.tidb_service.TidbService.batch_update_tidb_serverless_cluster_status` [bad-argument-type]
    --> providers/vdb/vdb-tidb-on-qdrant/tests/unit_tests/test_tidb_service.py:297:65
 ERROR Object of class `ModuleType` has no attribute `VectorType` [missing-attribute]
-  --> providers/vdb/vdb-tidb-vector/tests/unit_tests/test_tidb_vector.py:75:5
+  --> providers/vdb/vdb-tidb-vector/tests/unit_tests/test_tidb_vector.py:74:5
 ERROR Object of class `ModuleType` has no attribute `Vector` [missing-attribute]
   --> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:33:5
 ERROR Object of class `ModuleType` has no attribute `Index` [missing-attribute]

@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 57.97% 57.97% +0.00%
Strict coverage 57.54% 57.54% +0.00%
Typed symbols 37,794 37,796 +2
Untyped symbols 27,604 27,604 0
Modules 3132 3132 0

@crazywoola crazywoola mentioned this pull request Jun 3, 2026
@lyzno1 lyzno1 removed the javascript label Jun 3, 2026
@WH-2099 WH-2099 self-assigned this Aug 4, 2026
@zyqzyq zyqzyq changed the title add tool plugin param type date and date-picker feat:add tool plugin param type date and date-picker Aug 5, 2026
@zyqzyq
zyqzyq requested a review from WH-2099 as a code owner August 5, 2026 09:01
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Aug 5, 2026
@hjlarry hjlarry self-assigned this Aug 6, 2026
@autofix-ci
autofix-ci Bot requested a review from crazywoola as a code owner August 6, 2026 06:34
@hjlarry hjlarry changed the title feat:add tool plugin param type date and date-picker feat: add tool plugin param type date and date-picker Aug 6, 2026
@hjlarry
hjlarry requested a review from JzoNgKVO as a code owner August 7, 2026 01:30
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Aug 7, 2026
@hjlarry

hjlarry commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi @zyqzyq I use some exist compoents instead of <input type=date> to get better effect.
img_v3_0214b_cb70cd5b-6e9f-490a-b265-60dbdfe239dg

img_v3_0214b_d0b146f7-9d99-4685-a617-4b7ab9ab41ag img_v3_0214b_0de0437b-0968-420a-a1eb-9f4b2777703g

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 7, 2026
@WH-2099
WH-2099 added this pull request to the merge queue Aug 10, 2026
Merged via the queue into langgenius:main with commit df25042 Aug 10, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: tool plugin add date and date-picker type

4 participants