How mitohub74-sudo/chatwith works
Chatwith is a chat client with a Windows desktop app and a mobile H5/PWA. The main workflow is user input through the desktop renderer and IPC bridge to the main-process chat stream, which selects an OpenAI-compatible or AstrBot backend, then streams results back to the UI and saves the conversation. Sessions, configuration, and todos use local files; a separate reminder bubble handles due todos. The mobile app streams to AstrBot directly. The README documents an optional ECS HTTPS/tunnel deployment; its internal implementation is not mapped here.
Main entry points: ipc.ts IPC Handlers · chatStream.ts Chat Streaming · src/App.tsx Mobile Chat App · src/App.tsx Chat Window
Components 21
Desktop Chat
- Chat Window
src/renderer/src/App.tsx - Chat UI Components
src/renderer/src/components - Markdown Rendering
src/renderer/src/components/MarkdownContent.tsx
Chat Runtime
- Secure IPC Bridge
src/preload/index.ts - IPC Handlers
src/main/ipc.ts - Chat Streaming
src/main/chatStream.ts - Backend Configuration
src/main/config.ts
Local Data And Reminders
- Session Management
src/main/sessionStore.ts - Session Files
src/main/paths.ts - User Data Directory
src/main/paths.ts - Todo Management
src/main/todos.ts - Todo File
src/main/todos.ts - Reminder Bubble
src/main/bubble.ts
Mobile Client
- Mobile Chat App
mobile/src/App.tsx - Mobile SSE Client
mobile/src/lib/astrbotSse.ts - Mobile Markdown
mobile/src/lib/markdown.tsx
Other components
- Desktop User
- OpenAI-Compatible API
- AstrBot API
- Mobile User
- ECS HTTPS Tunnel
deploy/ecs
Connections 22
- Desktop User → Chat Window: sends messages
README.md - Chat Window → Chat UI Components: renders
src/renderer/src/App.tsx - Chat UI Components → Markdown Rendering: renders content
src/renderer/src/components/MessageList.tsx - Chat Window → Secure IPC Bridge: invokes chat IPC
src/renderer/src/App.tsx - Secure IPC Bridge → IPC Handlers: invokes channels
src/preload/index.ts - IPC Handlers → Chat Streaming: dispatches chat
src/main/ipc.ts - IPC Handlers → Session Management: manages sessions
src/main/ipc.ts - IPC Handlers → Backend Configuration: reads status
src/main/ipc.ts - Chat Streaming → Backend Configuration: loads settings
src/main/chatStream.ts - Chat Streaming → Session Management: reads and writes
src/main/chatStream.ts - Chat Streaming → OpenAI-Compatible API: streams requests
src/main/chatStream.ts - Chat Streaming → AstrBot API: streams requests
src/main/chatStream.ts - Session Management → Session Files: reads and writes
src/main/sessionStore.ts - Session Files → User Data Directory: resides in
src/main/paths.ts - IPC Handlers → Todo Management: manages todos
src/main/ipc.ts - Reminder Bubble → Todo Management: checks due items
src/main/bubble.ts - Todo Management → Todo File: reads and writes
src/main/todos.ts - Mobile User → Mobile Chat App: sends messages
README.md - Mobile Chat App → Mobile SSE Client: requests stream
mobile/src/App.tsx - Mobile Chat App → Mobile Markdown: renders content
mobile/src/App.tsx - Mobile SSE Client → AstrBot API: streams chat
README.md - Mobile Chat App → ECS HTTPS Tunnel: uses HTTPS route
README.md