dify/api/core/workflow
QuantumGhost 2c1ab4879f
refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025)
refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025)

This PR addresses serialization issues in the VariablePool model by separating the `value_type` tags for `IntegerSegment`/`FloatSegment` and `IntegerVariable`/`FloatVariable`. Previously, both Integer and Float types shared the same `SegmentType.NUMBER` tag, causing conflicts during serialization.

Key changes:
- Introduce distinct `value_type` tags for Integer and Float segments/variables
- Add `VariableUnion` and `SegmentUnion` types for proper type discrimination
- Leverage Pydantic's discriminated union feature for seamless serialization/deserialization
- Enable accurate serialization of data structures containing these types

Closes #22024.
2025-07-16 12:31:37 +08:00
..
callbacks update worklow events logs. (#19871) 2025-07-10 14:21:34 +08:00
entities refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
graph_engine refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
nodes refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
repositories fix(api): Fix resetting sys var causing internal server error (#21604) 2025-07-02 13:36:35 +08:00
utils refactor: move structured output support outside LLM Node (#21565) 2025-06-27 14:55:31 +08:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
constants.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
conversation_variable_updater.py feat: Persist Variables for Enhanced Debugging Workflow (#20699) 2025-06-24 09:05:29 +08:00
enums.py refactor(api/core/workflow/enums): Rename WORKFLOW_RUN_ID to WORKFLOW_EXECUTION_ID (#20459) 2025-05-30 11:05:08 +08:00
errors.py feat/enhance the multi-modal support (#8818) 2024-10-21 10:43:49 +08:00
system_variable.py refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
variable_loader.py fix(api): adding variable to variable pool recursively while loading draft variables. (#21478) 2025-06-25 12:39:22 +08:00
workflow_cycle_manager.py refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
workflow_engine_manager.py feat: Parallel Execution of Nodes in Workflows (#8192) 2024-09-10 15:23:16 +08:00
workflow_entry.py refactor(api): Separate SegmentType for Integer/Float to Enable Pydantic Serialization (#22025) 2025-07-16 12:31:37 +08:00
workflow_type_encoder.py feat: Persist Variables for Enhanced Debugging Workflow (#20699) 2025-06-24 09:05:29 +08:00