4.2 KiB
Local And Server Integration Plan
For agent: REQUIRED SUB-SKILL: Use Section 4 or Section 5 to implement this plan. Goal: Prepare
D:\Document Cleaningfor local and server integration, then execute real smoke tests for upload, conversion, download, deletion, and Dify sync where credentials allow. Architecture: Keep the existing Docker deployment path for server use, but add a direct local execution path that does not depend on Docker, Redis, or PostgreSQL being installed on the developer workstation. Real conversion should run through the existingedkb_systemand LibreOffice chain. Dify sync should use the existing production service when a real API key is present. Tech Stack: FastAPI, SQLAlchemy, Alembic, RQ, Redis, PostgreSQL, SQLite, Vue/Vite, LibreOffice
Current Environment Findings
dockeranddocker composeare not installed or not on PATH in the current Windows environment.- LibreOffice is installed locally at
C:\Program Files\LibreOffice\program\soffice.exe. - Python and Node are installed locally.
- Root
.envis missing. DIFY_API_KEYis currently empty in.env.example,backend.env.example, and the current process/user/machine environment.
Execution Strategy
Track 1: Server Path
Files:
- Modify as needed:
docker-compose.yml - Modify as needed:
.env.example - Modify as needed:
backend/backend.env.exampleSteps:
- Normalize environment variable handling so
PUBLIC_BASE_URLand the Dify settings are driven by.env. - Create a real root
.envfile for the current machine. - Verify the compose configuration is ready for the target server once Docker is available.
Track 2: Local Path
Files:
- Modify as needed:
backend/app/config.py - Modify as needed:
backend/app/services/queue_service.py - Modify as needed:
backend/worker.py - Modify as needed:
.env.example - Modify as needed:
backend/backend.env.exampleSteps:
- Add a local task execution mode that can run queue tasks inline without Redis.
- Keep the existing RQ mode unchanged for server deployment.
- Configure the current workstation to use SQLite plus inline execution for local smoke tests.
Task 1: Prepare integration configuration
Files:
- Modify:
docker-compose.yml - Modify:
.env.example - Modify:
backend/backend.env.example - Create:
.envStep 1: Add all required variables for local and server paths, includingPUBLIC_BASE_URLand a task execution mode switch. Step 2: Keep production defaults intact where possible. Step 3: Verify the resulting configuration files are internally consistent.
Task 2: Add local inline task execution mode
Files:
- Modify:
backend/app/config.py - Modify:
backend/app/services/queue_service.py - Modify as needed:
backend/tests/*Step 1: Add a configuration switch that chooses betweenrqandsync. Step 2: Insyncmode, executeapp.tasks.run_convert_jobandapp.tasks.run_sync_jobinline while preserving persisted job state. Step 3: Verify the existing backend tests still pass after the change.
Task 3: Start the local integration stack
Files:
- Read:
frontend/vite.config.ts - Read:
backend/alembic.ini - Read:
backend/migrations/env.pyStep 1: Run Alembic against the local database. Step 2: Start the backend locally. Step 3: Start the frontend locally if needed for manual browser access. Step 4: Confirm health and login endpoints respond over HTTP.
Task 4: Run real smoke tests
Files:
- Read:
backend/data/original/**/* - Use runtime data under
backend/data/Step 1: Create a real group and upload a real document through the running API. Step 2: Verify conversion completes using the existing document cleaning pipeline and LibreOffice path. Step 3: Verify original download, markdown download, and local delete. Step 4: Attempt real Dify sync if a valid key is available; otherwise capture the exact blocker and the furthest successful precondition.
Task 5: Report integration status
Files:
- Read: generated runtime output and logs Step 1: Record what was prepared for server deployment. Step 2: Record what was proven locally with real runtime execution. Step 3: Record any remaining blockers, especially around Docker and Dify credentials.