How syschat0/docugen works
LLM Document Agent is a FastAPI document-writing product with a static web UI and SQLite persistence. The main workflow creates a project, gathers and saves intake answers when needed, then runs staged research and writing; users can review progress and retrieve the resulting draft and artifacts. The README also documents document-type profiles, source and citation quality checks, project settings, and optional illustration generation. The large repository module owns much of the workflow orchestration. Some subsystem links below are documented capabilities; unsampled implementation details are not asserted.
Main entry points: repositories.py Workflow orchestration · search.py Research search · main.py FastAPI app · llm.py LLM writing
Components 23
Application and API
- Web UI
app/static/app.js - FastAPI app
app/main.py - Projects API
app/api/projects.py - Workflow API
app/api/workflow.py - Questions API
app/api/questions.py - Artifacts API
app/api/artifacts.py - Settings API
app/api/settings.py
Writing workflow
- Workflow orchestration
app/db/repositories.py - LLM writing
app/services/llm.py - Document profiles
app/services/doc_types.py - Citation handling
app/services/citations.py - Illustration generation
app/services/image_gen.py
Research and quality
- Research search
app/services/search.py - Browser search
app/services/browser_search.py - Google PSE
app/services/google_pse.py - Quality checks
app/services/quality.py - Evidence validation
app/services/evidence.py
Persistence and settings
- SQLite database
app/db/session.py - LLM settings
app/services/llm_settings.py - Image settings
app/services/image_settings.py - Search options
app/services/search_options.py - Runtime configuration
app/core/config.py
Other components
- Writer
Connections 37
- Writer → Web UI: uses
README.md - Web UI → Workflow API: starts writing
README.md - FastAPI app → Projects API: mounts
app/main.py - FastAPI app → Workflow API: mounts
app/main.py - FastAPI app → Questions API: mounts
app/main.py - FastAPI app → Artifacts API: mounts
app/main.py - FastAPI app → Settings API: mounts
app/main.py - Projects API → Workflow orchestration: calls
app/api/projects.py - Projects API → Document profiles: reads profiles
app/api/projects.py - Projects API → Search options: reads defaults
app/api/projects.py - Workflow API → Workflow orchestration: calls
app/api/workflow.py - Workflow API → SQLite database: uses run control
app/api/workflow.py - Questions API → Workflow orchestration: calls
app/api/questions.py - Artifacts API → Workflow orchestration: calls
app/api/artifacts.py - Settings API → LLM settings: configures
app/api/settings.py - Settings API → Image settings: configures
app/api/settings.py - Workflow orchestration → SQLite database: reads and writes
app/db/repositories.py - Workflow orchestration → LLM writing: runs stages
app/db/repositories.py - Workflow orchestration → Research search: requests research
app/db/repositories.py - Workflow orchestration → Citation handling: uses
app/db/repositories.py - Workflow orchestration → Quality checks: checks drafts
app/db/repositories.py - Workflow orchestration → Evidence validation: validates evidence
- Workflow orchestration → Illustration generation: generates images
app/db/repositories.py - Research search → Browser search: searches pages
app/services/search.py - Research search → Google PSE: uses engine
app/services/search.py - Research search → Quality checks: ranks sources
app/services/search.py - Browser search → Google PSE: uses engine
app/services/browser_search.py - LLM writing → Citation handling: uses
app/services/llm.py - LLM writing → Document profiles: uses profiles
app/services/llm.py - Quality checks → Evidence validation: uses validation
app/services/quality.py - LLM settings → SQLite database: stores settings
app/services/llm_settings.py - Image settings → SQLite database: stores settings
app/services/image_settings.py - LLM writing → LLM settings: resolves provider
app/services/llm.py - Research search → Search options: reads options
app/services/search.py - LLM writing → Search options: reads options
app/services/llm.py - LLM settings → Runtime configuration: uses defaults
app/services/llm_settings.py - Research search → Runtime configuration: uses defaults
app/services/search.py