Document Version Comparison
Document Version Comparison
Implemented in version: 0.241.097 Related version update:
application/single_app/config.pynow reports version0.241.097.
Overview
Document comparison now supports selecting multiple stored revisions from the same document family instead of limiting comparison targets to the current revision of each selected document. This lets users compare v1 vs v2, v1 vs v3, or mix one document’s older revisions with other selected documents in both chat and workflow experiences.
Dependencies:
application/single_app/functions_documents.pyapplication/single_app/route_backend_documents.pyapplication/single_app/route_backend_group_documents.pyapplication/single_app/route_backend_public_documents.pyapplication/single_app/static/js/chat/chat-documents.jsapplication/single_app/static/js/chat/chat-messages.jsapplication/single_app/static/js/workspace/workspace_workflows.jsapplication/single_app/templates/chats.htmlapplication/single_app/templates/workspace.html
Technical Specifications
Architecture overview:
- Each stored document revision keeps its own document id while sharing a
revision_family_idwith the rest of the family. - New per-scope version endpoints expose all stored revisions for a selected document family in personal, group, and public workspaces.
- Chat comparison expands selected current documents into version-specific comparison targets and lets the user choose the left-side baseline from the chosen revisions.
- Workflow comparison uses the same version-target model and saves version-specific ids in the existing comparison payload fields.
API endpoints:
GET /api/documents/<document_id>/versionsGET /api/group_documents/<document_id>/versions?group_id=<group_id>GET /api/public_workspace_documents/<document_id>/versions?workspace_id=<workspace_id>
Configuration options:
- Existing document action capability limits continue to apply.
- Comparison document counts are now based on the selected version targets instead of the number of currently selected document families.
File structure:
- Version metadata exposure:
application/single_app/functions_documents.py - Personal document versions route:
application/single_app/route_backend_documents.py - Group document versions route:
application/single_app/route_backend_group_documents.py - Public workspace versions route:
application/single_app/route_backend_public_documents.py - Chat comparison UI:
application/single_app/templates/chats.html - Chat comparison behavior:
application/single_app/static/js/chat/chat-documents.js,application/single_app/static/js/chat/chat-messages.js - Workflow comparison UI and payload builder:
application/single_app/templates/workspace.html,application/single_app/static/js/workspace/workspace_workflows.js
Usage Instructions
How to use in chat:
- Open chat and enable document search.
- Select one or more documents.
- Change the action to
Compare. - Choose the versions you want to compare from
Comparison Versions. - Pick the left-side baseline version.
- Send the compare request.
How to use in workflows:
- Open
Personal Workspaceand go toYour Workflows. - Create or edit a workflow.
- Change the action type to
Compare. - Select workspace documents and choose
Use selected workspace documents. - Pick the comparison versions and choose the left-side baseline version.
- Save the workflow.
Integration points:
- Chat requests continue to submit
left_document_idandright_document_ids, but those ids can now be multiple revisions from one document family. - Workflow saves use the same payload shape, so no backend workflow contract change is required.
Testing And Validation
Functional coverage:
functional_tests/test_document_actions_and_comparison_feature.pyverifies the new version endpoints, version-aware chat and workflow selectors, and the linked feature documentation.
UI coverage:
ui_tests/test_chat_document_action_selector_labels.pyvalidates the chat comparison version selector and left-side version picker.ui_tests/test_workflow_document_action_modal.pyvalidates workflow version selection and saved comparison payloads.
Performance and limitations:
- Version selectors currently load on demand per selected document family.
- Workflow version selection is driven from the currently selected personal workspace documents.
- Existing administrator document action limits still cap how many comparison targets can run in one request.