[PR #30721] feat: add vibe workflow #32945

Closed
opened 2026-02-21 20:52:22 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/30721

State: closed
Merged: No


Summary

feat https://github.com/langgenius/dify/issues/29774

This PR refactors the Vibe Workflow generation logic, extracting it from api/core/llm_generator into a dedicated, modular architecture in api/core/workflow/generator. It introduces a robust 5-step generation process (Planner -> Context Filter -> Builder -> Repair -> Validate) to improve the stability and quality of generated workflows.

Key Changes

  1. Modular Architecture (api/core/workflow/generator)
    Planner: Responsible for generating the high-level workflow structure.
    Builder: Handles the detailed configuration of individual nodes.
    Validation Engine: A comprehensive rule-based system (ValidationEngine, WorkflowValidator) to check node and edge validity.
    Auto-Repair: Implemented NodeRepair and EdgeRepair to automatically fix common generation errors (e.g., disconnected edges, invalid fields).
    Mermaid Visualization: Added MermaidGenerator for workflow flowchart rendering.
  2. Improvements & Fixes
    Stability Warning: Added a localized stability warning (Chinese/English) to the API response to inform users that generated workflows may require debugging.
    Pydantic Fix: Fixed a validation error in CodeNodeData where outputs.status could receive a string instead of a dictionary.
    Linting & Cleanup:
    Fixed multiple ruff linting errors (line lengths, implicit optionals, redundant exceptions).
    Removed accidentally tracked .pyc files from the repository.
  3. Testing
    Added comprehensive unit tests for the new components:
    test_mermaid_generator.py
    test_node_repair.py
    test_planner_prompts.py
    test_validation_engine.py
    test_workflow_validator_vibe.py
**Original Pull Request:** https://github.com/langgenius/dify/pull/30721 **State:** closed **Merged:** No --- ## Summary feat https://github.com/langgenius/dify/issues/29774 This PR refactors the Vibe Workflow generation logic, extracting it from api/core/llm_generator into a dedicated, modular architecture in api/core/workflow/generator. It introduces a robust 5-step generation process (Planner -> Context Filter -> Builder -> Repair -> Validate) to improve the stability and quality of generated workflows. ### Key Changes 1. Modular Architecture (api/core/workflow/generator) Planner: Responsible for generating the high-level workflow structure. Builder: Handles the detailed configuration of individual nodes. Validation Engine: A comprehensive rule-based system (ValidationEngine, WorkflowValidator) to check node and edge validity. Auto-Repair: Implemented NodeRepair and EdgeRepair to automatically fix common generation errors (e.g., disconnected edges, invalid fields). Mermaid Visualization: Added MermaidGenerator for workflow flowchart rendering. 2. Improvements & Fixes Stability Warning: Added a localized stability warning (Chinese/English) to the API response to inform users that generated workflows may require debugging. Pydantic Fix: Fixed a validation error in CodeNodeData where outputs.status could receive a string instead of a dictionary. Linting & Cleanup: Fixed multiple ruff linting errors (line lengths, implicit optionals, redundant exceptions). Removed accidentally tracked .pyc files from the repository. 3. Testing Added comprehensive unit tests for the new components: test_mermaid_generator.py test_node_repair.py test_planner_prompts.py test_validation_engine.py test_workflow_validator_vibe.py
yindo added the pull-request label 2026-02-21 20:52:22 -05:00
yindo closed this issue 2026-02-21 20:52:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32945