How vali-98/chatterui works
ChatterUI is a native mobile frontend for chatting with characters or assistants through either on-device models or remote APIs. The main workflow is to select a character and chat, build a prompt from chat and character context, route generation to local inference or a configured API, then display the response. The app also manages characters, chat history, connections, formatting, sampler settings, lorebooks, users, and TTS. Some screen-to-state and database links are documented only at the product level; those links are dashed where source evidence was not sampled.
Main entry points: Characters.ts Character state · Inference.ts Inference router · APIBuilder.ts API request builder · ContextBuilder.ts Context builder
Components 29
Chat experience
- Character browser
app/screens/CharacterListScreen/index.tsx - Chat screen
app/screens/ChatScreen/index.tsx
Generation
- Inference router
lib/engine/Inference.ts - Context builder
lib/engine/API/ContextBuilder.ts - Context sources
lib/engine/DataSources/index.ts - Lorebook source
lib/engine/DataSources/lorebookSource.ts - Local inference
lib/engine/LocalInference.ts - Llama runtime
lib/engine/Local/LlamaLocal.ts - API request builder
lib/engine/API/APIBuilder.ts - API providers
lib/engine/API/DefaultAPI.ts
Content and settings
- Character editor
app/screens/CharacterEditorScreen.tsx - Connection manager
app/screens/ConnectionsManagerScreen/index.tsx - Formatting manager
app/screens/FormattingManagerScreen/index.tsx - Sampler settings
app/screens/SamplerManagerScreen/index.tsx - Lorebook manager
app/screens/LorebookManagerScreen/index.tsx - User manager
app/screens/UserManagerScreen/index.tsx - TTS manager
app/screens/TTSManagerScreen.tsx - Model manager
app/screens/ModelManagerScreen/index.tsx - App settings
app/screens/AppSettingsScreen/index.tsx
State and persistence
- Chat state
lib/state/Chat.ts - Character state
lib/state/Characters.ts - App database
db/schema.ts - Author notes
lib/state/AuthorNotes.ts - MMKV storage
lib/storage/MMKV.ts - Startup setup
lib/utils/Startup.ts - Theme state
lib/theme/ThemeManager.ts - Log state
lib/state/Logger.ts
Other components
- Mobile user
- Remote model APIs
Connections 34
- Mobile user → Character browser: browses characters
- Mobile user → Chat screen: chats
- Character browser → Character state: selects character
- Chat screen → Inference router: requests generation
lib/engine/Inference.ts - Inference router → Local inference: routes local
lib/engine/Inference.ts - Inference router → API request builder: routes remote
lib/engine/Inference.ts - Inference router → Context sources: loads sources
lib/engine/Inference.ts - Inference router → Chat state: reads chat state
lib/engine/Inference.ts - Inference router → Character state: reads character state
lib/engine/Inference.ts - Local inference → Context builder: builds prompt
lib/engine/LocalInference.ts - Local inference → Llama runtime: runs model
lib/engine/LocalInference.ts - API request builder → Context builder: builds request context
lib/engine/API/APIBuilder.ts - API request builder → Remote model APIs: sends request
- API request builder → API providers: uses provider config
- Context sources → Lorebook source: registers source
lib/engine/DataSources/index.ts - Context builder → Chat state: reads chat content
lib/engine/API/ContextBuilder.ts - Context builder → Character state: reads character data
lib/engine/API/ContextBuilder.ts - Chat screen → Chat state: manages chats
- Character editor → Character state: edits characters
- Connection manager → API request builder: configures connections
- Formatting manager → Context builder: configures formatting
- Sampler settings → API request builder: configures samplers
- Lorebook manager → Lorebook source: manages lorebooks
- User manager → Character state: manages user card
- Model manager → Llama runtime: manages local models
- TTS manager → Chat screen: provides speech
- App settings → Theme state: configures appearance
- Character state → MMKV storage: persists state
lib/state/Characters.ts - Log state → MMKV storage: persists logs
lib/state/Logger.ts - Theme state → MMKV storage: persists colors
lib/theme/ThemeManager.ts - Author notes → App database: reads and writes notes
lib/state/AuthorNotes.ts - Startup setup → Character state: initializes user data
lib/utils/Startup.ts - Startup setup → App database: runs migrations
lib/utils/Startup.ts - Chat state → App database: stores chat data