How 5945ggh/folio-j works
Folio-J is a local Japanese-reading app for managing sources and manually entered excerpts, discussing excerpts with background model-powered chat, and maintaining learner/provider settings. The main workflow is to create a source and excerpt, open its reading workspace, then submit questions to a durable chat job and revisit its history. The backend also exposes analysis management and job-agent analysis tools; independent explanations and accumulated learning entries are described as future work. Relationships for unsampled route and frontend modules are included only where documented or indexed; uncertain wiring is omitted.
Main entry points: main.py ASGI app · App.tsx App routes · chat.py Chat lifecycle · settings.py Provider and learning settings
Components 27
Reading interface
- App routes
frontend/src/App.tsx - Source pages
frontend/src/SourcePages.tsx - Excerpt workspace
frontend/src/SegmentPage.tsx - Discussion workbench
frontend/src/chat/Workbench.tsx - Settings pages
frontend/src/settings/SettingsPage.tsx - Source API client
frontend/src/content.ts - Chat API client
frontend/src/chat/api.ts - Settings API client
frontend/src/settings/api.ts
API and domain
- ASGI app
backend/src/app/main.py - Source routes
backend/src/app/api/sources.py - Settings routes
backend/src/app/api/settings.py - Chat routes
backend/src/app/api/chat.py - Analysis routes
backend/src/app/api/analyses.py - Source management
backend/src/app/services/sources.py - Chat lifecycle
backend/src/app/services/chat.py - Prompt context
backend/src/app/services/context.py - Analysis management
backend/src/app/services/analyses.py - Provider and learning settings
backend/src/app/services/settings.py
Background work
- Job supervisor
backend/src/app/jobs/runtime.py - Chat agent
backend/src/app/jobs/agent.py - Model adapters
backend/src/app/llm/adapters.py
Persistence and models
- SQLite engine
backend/src/app/db.py - Source and settings models
backend/src/app/models.py - Chat job models
backend/src/app/chat_models.py - Settings models
backend/src/app/settings_models.py
Other components
- Reader
- Model provider
Connections 33
- Reader → App routes: uses
README.md - App routes → Source pages: routes to
frontend/src/App.tsx - App routes → Excerpt workspace: routes to
frontend/src/App.tsx - App routes → Settings pages: routes to
frontend/src/App.tsx - Source pages → Source API client: requests
- Excerpt workspace → Discussion workbench: renders
frontend/src/SegmentPage.tsx - Excerpt workspace → Source API client: requests
frontend/src/SegmentPage.tsx - Discussion workbench → Chat API client: requests
frontend/src/chat/Workbench.tsx - Settings pages → Settings API client: requests
- Source API client → ASGI app: HTTP requests
frontend/src/content.ts - Chat API client → ASGI app: HTTP requests
frontend/src/chat/api.ts - Settings API client → ASGI app: HTTP requests
frontend/src/settings/api.ts - ASGI app → Source routes: registers
backend/src/app/main.py - ASGI app → Settings routes: registers
backend/src/app/main.py - ASGI app → Chat routes: registers
backend/src/app/main.py - ASGI app → Analysis routes: registers
backend/src/app/main.py - Source routes → Source management: delegates
backend/src/app/api/sources.py - Settings routes → Provider and learning settings: delegates
backend/src/app/api/settings.py - Chat routes → Chat lifecycle: delegates
- Chat lifecycle → Prompt context: builds context
backend/src/app/services/chat.py - Chat lifecycle → Provider and learning settings: loads settings
backend/src/app/services/chat.py - ASGI app → Job supervisor: starts worker
backend/src/app/main.py - Job supervisor → Chat agent: runs jobs
backend/src/app/jobs/runtime.py - Chat agent → Model adapters: calls model
backend/src/app/jobs/agent.py - Chat agent → Analysis management: creates analysis
backend/src/app/jobs/agent.py - Provider and learning settings → Model adapters: verifies models
backend/src/app/services/settings.py - Model adapters → Model provider: calls
backend/src/app/llm/adapters.py - ASGI app → SQLite engine: creates engine
backend/src/app/main.py - Source routes → SQLite engine: uses sessions
backend/src/app/api/sources.py - Settings routes → SQLite engine: uses sessions
backend/src/app/api/settings.py - Source management → Source and settings models: manages records
backend/src/app/services/analyses.py - Chat lifecycle → Chat job models: manages history
backend/src/app/services/chat.py - Provider and learning settings → Settings models: manages settings
backend/src/app/services/settings.py