Files
syops/project-governance/plans/2026-03-28-dify-diff-and-group-ux-plan.md
2026-04-27 17:03:56 +08:00

3.2 KiB

Dify Diff And Group UX Plan

For agent: Execute directly against the existing implementation. Keep the current server deployment and avoid rebuilding core business logic.

Goal: Make the group area operationally clean, add a concrete Dify-vs-local diff surface for selected groups, prevent accidental duplicate pushes, and resolve the current stuck sync pair on the server.

Architecture: Keep the current FastAPI + worker + Vue SPA + Docker Compose structure. Add a lightweight comparison endpoint and a focused workspace UI refinement without introducing new dependencies.

Current Findings

  • The current sync failure is not caused by missing embedding or rerank model settings.
  • The latest failed job timed out while waiting for Dify indexing, and the remote document remained stuck in indexing.
  • Group cards still expose oversized management controls and the workspace does not yet provide a direct “show me local vs Dify differences” view.
  • Current wording around Dify actions still risks reading like bidirectional sync when the implemented behavior is local push plus remote mapping.

Execution Tracks

Track 1: Group UX refinement

Files:

  • Modify: frontend/src/views/WorkspaceView.vue
  • Modify: frontend/src/style.css
  • Modify: frontend/src/lib/i18n.ts

Steps:

  1. Replace large group edit/delete buttons with compact icon actions on the group card.
  2. Keep inline create only for the empty-state path.
  3. Move group management to card-level actions only and keep the selected-group summary informational.
  4. Tighten copy so Dify actions read as push/status, not realtime bidirectional sync.

Track 2: Dify diff surface

Files:

  • Modify: backend/app/services/dify_service.py
  • Modify: backend/app/api/groups.py
  • Modify: frontend/src/views/WorkspaceView.vue
  • Modify: frontend/src/lib/i18n.ts
  • Modify tests under backend/tests/

Steps:

  1. List remote Dify documents for the selected dataset.
  2. Compare local documents and remote documents by normalized document name within the selected group.
  3. Return summary buckets and row-level status so the UI can show matched, local-only, Dify-only, and attention items.
  4. Add a modal viewer in the workspace with search by file name inside the selected group.

Track 3: Duplicate push guard and dirty data cleanup

Files:

  • Modify: backend/app/api/files.py
  • Apply one-off server cleanup for the current stuck local/remote record pair

Steps:

  1. Reject single-document pushes when the current version is already marked synced.
  2. Skip already-synced rows during batch push.
  3. Delete the currently stuck remote Dify document and clear the corresponding local failed sync state so the next push starts from a clean baseline.
  4. Rebuild only affected services and run a real server verification pass.

Verification

  1. Run targeted backend tests for diff and push guard behavior.
  2. Run frontend npm run build.
  3. Deploy updated backend and frontend services to 192.168.100.230.
  4. Verify group actions are compact and usable in the browser.
  5. Verify the Dify diff modal reflects matched, local-only, Dify-only, and attention states.
  6. Re-run a real Dify push after cleanup and confirm it reaches a completed indexing state.