How chenwenyu1014/csr works
CSR Document Generation System turns project source files and data requirements into generated CSR narratives and completed Word documents. Its main workflow spans source validation and allocation, cross-platform file preprocessing, evidence extraction, LLM paragraph generation, and template insertion; separate API capabilities also support standalone preprocessing, insertion, allocation, validation, and document cleanup. Linux owns orchestration and model-facing work, while the Windows bridge handles Office-document operations. The README documents the overall service boundary; sampled source excerpts provide implementation detail for selected generation, model, and preprocessing components only.
Main entry points: main.py Linux API Routes · windows_bridge_client.py Windows Bridge Client · compose.py Compose Endpoint · pipeline.py Generation Pipeline
Components 26
Linux API
- Linux API Routes
api/linux/main.py - Validation Endpoint
api/linux/validation.py - Allocation Endpoint
api/linux/allocation.py - Preprocessing Endpoint
api/linux/preprocessing.py - Generation Endpoint
api/linux/generation.py - Compose Endpoint
api/linux/compose.py - Insertion Endpoint
api/linux/insertion.py - Cleanup Endpoint
api/linux/postprocessing.py
CSR Workflows
- Source Validation
service/linux/validation/validation_service.py - Data Allocation
service/linux/allocation/allocation_service.py - Preprocessing Tasks
service/linux/preprocessing/preprocessing_task_service.py - Generation Flow Controller
service/linux/generation/flow_controller.py - Generation Pipeline
service/linux/generation/pipeline.py - Data Extraction
service/linux/generation/data_extractor.py - Paragraph Generation
service/linux/generation/paragraph_generation_service.py - Template Handling
service/linux/template/template_service.py - Windows Bridge Client
service/linux/bridge/windows_bridge_client.py
Windows Processing
- Windows Bridge API
api/windows/app.py - Office File Processing
service/windows/preprocessing/service.py - Format Pipelines
service/windows/preprocessing/preprocessing_function - Word Insertion
service/windows/insertion/word_document_service.py
Models and Prompts
- LLM Model Services
service/models/model_service.py - Prompt Management
service/prompts/system_prompt_manager.py
Other components
- CSR User
- Microsoft Office COM
- RAGFlow Retrieval
utils/ragflow_client.py
Connections 29
- CSR User → Linux API Routes: calls API
- Linux API Routes → Validation Endpoint: dispatches
- Linux API Routes → Allocation Endpoint: dispatches
- Linux API Routes → Preprocessing Endpoint: dispatches
- Linux API Routes → Generation Endpoint: dispatches
- Linux API Routes → Compose Endpoint: dispatches
- Linux API Routes → Insertion Endpoint: dispatches
- Linux API Routes → Cleanup Endpoint: dispatches
- Validation Endpoint → Source Validation: validates source
- Allocation Endpoint → Data Allocation: allocates data
- Preprocessing Endpoint → Preprocessing Tasks: starts tasks
- Generation Endpoint → Generation Flow Controller: starts generation
- Compose Endpoint → Generation Flow Controller: generates content
- Compose Endpoint → Insertion Endpoint: requests insertion
- Insertion Endpoint → Windows Bridge Client: requests insertion
- Cleanup Endpoint → Windows Bridge Client: requests cleanup
- Generation Flow Controller → Generation Pipeline: runs pipeline
- Generation Pipeline → Data Extraction: extracts evidence
- Generation Pipeline → Paragraph Generation: generates paragraphs
- Preprocessing Tasks → Windows Bridge Client: forwards processing
- Windows Bridge Client → Windows Bridge API: sends HTTP
- Windows Bridge API → Office File Processing: dispatches processing
- Office File Processing → Format Pipelines: processes formats
- Windows Bridge API → Word Insertion: dispatches documents
- Word Insertion → Microsoft Office COM: controls Word
- Paragraph Generation → Prompt Management: builds prompts
- Paragraph Generation → LLM Model Services: requests generation
- Source Validation → LLM Model Services: requests validation
- LLM Model Services → RAGFlow Retrieval: retrieves context