-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
Feat: Add flow versioning system with master-version pattern #5632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Add flow versioning system with master-version pattern #5632
Conversation
Summary of ChangesHello @AhmedRaafat14, 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 significantly enhances the platform's capabilities by introducing a comprehensive versioning system for ChatFlows and AgentFlows. It addresses the challenges of managing flow updates by providing a structured approach to track changes, maintain drafts, and designate active versions. This feature streamlines the development lifecycle of conversational AI flows, making it easier for users to iterate, test, and deploy changes safely and efficiently. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a comprehensive versioning system for chatflows, a significant and valuable feature. The implementation includes new backend tables, services, and endpoints, along with corresponding frontend components for version management. The database migrations are well-crafted for all supported databases.
My review has identified a few areas for improvement to enhance the robustness and correctness of this new feature. I've pointed out a potential race condition in the version creation logic, a critical bug in the canvas component that could lead to loading stale data, and some minor code style issues. Addressing these points will help ensure the versioning system is reliable and maintainable.
23c3473 to
f6eb7f8
Compare
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This is a comprehensive and well-executed pull request that introduces a much-needed versioning system for chatflows. The implementation of the Master-Version pattern is thorough, covering database migrations, new API endpoints, and frontend UI changes. The backward compatibility is a huge plus. My feedback focuses on improving maintainability by reducing code duplication in the backend services and controllers, and enhancing code readability in the frontend components. All original comments were kept as they did not contradict the provided rule regarding generic images for error pages.
packages/server/src/database/migrations/mariadb/1770000000001-MigrateChatFlowToVersioning.ts
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This is a significant and well-executed feature that introduces a comprehensive versioning system for flows. The implementation is thorough, covering database migrations for all supported systems, new backend services and endpoints, and a well-integrated UI for version management. The master-version pattern is a solid approach, and the backward compatibility for existing flows is a huge plus. My review focuses on a few opportunities to improve maintainability by reducing code duplication and improving type safety, which are common in a feature of this scale.
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a comprehensive versioning system for ChatFlows and AgentFlows, which is a significant and well-executed feature. The changes are extensive, touching the backend, frontend, and database, including migrations for all supported database systems. The implementation of the master-version pattern is solid, with good use of database transactions to ensure data integrity. The frontend changes provide a clear and intuitive user experience for managing versions. Overall, this is an excellent contribution that greatly enhances the platform's capabilities. I've pointed out a potential unintentional feature removal and a couple of minor code quality improvements.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/server/src/services/export-import/index.ts (804-960)
The function exportChatflowMessages and its helpers have been removed in this pull request. This appears to be a feature removal that is not mentioned in the PR description. If this is unintentional, it should be restored. If it's an intentional change, it would be good to document it as a breaking change.
packages/server/src/services/export-import/index.ts (639)
The queryRunner variable is not typed. For better type safety and code clarity, it should be explicitly typed as QueryRunner.
let queryRunner: QueryRunner
packages/ui/src/views/canvas/CanvasHeader.jsx (254-257)
This function _onSaveChatflowClick seems to be unused after refactoring the save button logic. It can be removed to improve code clarity.
|
thank you so much @AhmedRaafat14 for the PR! we were also having similar work under development, although there is some difference. Main thing being we also wanted to change how API access should be together with publishing and versioning:
|
Summary
Implements a comprehensive versioning system for ChatFlows and AgentFlows, allowing users to create, manage, and switch between multiple versions of their flows.
Problem
Currently, I face some problems when I need to update an existing flow without losing my existing one, I faced these problems:
predicationsendpoint with the new flow ID.This leads to cluttered flow lists, no clear version history, difficulty rolling back, and risk of deploying the wrong version.
Solution
Implements a Master-Version Pattern that:
I have implemented these changes in my self-hosted version of Flowise and have been using it for some time now, so it would be useful to share with the community and give back.
Key Features
api/v1/prediction/{ID}/versions/{VERSION_NUMBER}, this allows you to test a specific version before publishing it.Database Changes
New Tables
chat_flow_master- Stores high-level flow metadata with stable IDchat_flow_version- Stores individual versions with complete configurationMigrations
chat_flowrecords to a versioned structureisActive = true.API Endpoints
/api/v1/chatflows/:id/versions/api/v1/chatflows/:id/versions/:version/api/v1/chatflows/:id/versions/api/v1/chatflows/:id/versions/:version/api/v1/chatflows/:id/active-version/api/v1/chatflows/:id/versions/:versionFiles Changed
Backend (New)
packages/server/src/database/entities/ChatFlowMaster.tspackages/server/src/database/entities/ChatFlowVersion.tspackages/server/src/services/chatflow-versions/index.tspackages/server/src/controllers/chatflow-versions/index.tspackages/server/src/routes/chatflow-versions/index.tsFrontend (New)
packages/ui/src/ui-component/dialog/VersionHistoryDialog.jsx.Modified
packages/server/src/Interface.ts- Added interfacespackages/server/src/routes/index.ts- Registered routespackages/ui/src/api/chatflows.js- Added API methodspackages/ui/src/views/canvas/index.jsx- Version state & handlerspackages/ui/src/views/canvas/CanvasHeader.jsx- Version UI componentspackages/ui/src/views/agentflowsv2/Canvas.jsx- AgentFlow version supportTest Plan
Breaking Changes
None - fully backward compatible. All existing API endpoints and flows continue to work without modification.
Recording
Flow_Versioning.1.mp4