Files
syops/project-governance/plans/2026-03-28-product-ui-and-deploy-hygiene-plan.md
T
2026-04-27 17:03:56 +08:00

70 lines
3.5 KiB
Markdown

# Product UI And Deploy Hygiene Plan
> **For agent:** Execute directly against the existing implementation. Do not rebuild the stack from scratch.
**Goal:** Lift the current document cleaning system from an internal-tool baseline to a more professional product interface, tighten the local-to-server deployment workflow, and make Dify dataset model selection automatic instead of relying on manual console completion.
**Architecture:** Keep the current FastAPI + worker + Vue SPA + Docker Compose structure. Improve only the frontend experience, Dify integration defaults, and deployment packaging boundaries.
## Current Findings
- The core business flow is already usable end to end on the server.
- The frontend still reads as an engineering utility rather than a finished product surface.
- Server deployments were previously syncing non-runtime content such as `project-governance` and test artifacts.
- Dify dataset creation succeeded, but embedding and rerank model assignment was not being written by the API layer.
## Execution Tracks
### Track 1: Productize the frontend
**Files:**
- Modify: `frontend/src/style.css`
- Modify: `frontend/src/App.vue`
- Modify: `frontend/src/views/LoginView.vue`
- Modify: `frontend/src/views/WorkspaceView.vue`
- Modify: `frontend/src/views/AdminView.vue`
- Modify as needed: `frontend/src/components/*`
- Modify as needed: `frontend/src/lib/i18n.ts`
**Steps:**
1. Introduce a clearer visual direction with stronger surfaces, hierarchy, spacing, and global polish.
2. Keep the existing route structure and API contract intact.
3. Add bilingual UI support and a global language switch without introducing new dependencies.
4. Improve the admin configuration experience so Dify defaults feel like product settings, not raw system fields.
### Track 2: Automate Dify model selection
**Files:**
- Modify: `backend/app/services/dify_service.py`
- Modify: `backend/app/tasks.py`
- Modify: `backend/app/models.py`
- Modify: `backend/app/schemas.py`
- Modify: `backend/app/serializers.py`
- Modify: `backend/app/api/admin.py`
- Modify: `backend/app/services/bootstrap_service.py`
- Modify: `backend/app/config.py`
- Create: `backend/migrations/versions/20260328_0002_dify_model_defaults.py`
- Modify tests under `backend/tests/`
**Steps:**
1. Query the live Dify model catalog for embedding and rerank providers/models.
2. Apply a deterministic automatic choice when admin settings leave model fields empty.
3. Expose available models and automatic defaults in the admin API.
4. Allow explicit override from the admin UI while keeping automatic selection as the default path.
### Track 3: Tighten deployment boundaries
**Files:**
- Modify as needed: deployment packaging commands/scripts
- Keep on server only runtime files and secrets
**Steps:**
1. Exclude governance docs, tests, caches, local databases, and built artifacts from server syncs.
2. Remove already-synced non-runtime directories from the server deployment tree.
3. Rebuild only affected services after frontend/backend changes.
## Verification
1. Run targeted backend tests for admin settings and Dify task flows.
2. Run full backend `pytest` once the backend changes settle.
3. Run frontend `npm run build`.
4. Rebuild the changed Docker services on the server.
5. Execute a real server smoke test for login, upload, conversion, markdown download, Dify sync, and delete with `delete_dify=true`.
6. Confirm through the Dify API that new datasets carry embedding/rerank model settings and that remote documents return `404` after delete.