# iwyxdxl/pawzochat architecture

> Architecture diagram of the GitHub repository iwyxdxl/pawzochat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iwyxdxl/pawzochat
- Repository: https://github.com/iwyxdxl/pawzochat

## Overview

PawzoChat is an extensible AI companion platform that brings character-based conversations to WeChat, QQ, and a Web panel. Its principal workflow receives a message through a channel, queues and processes a conversation round with configured context and model/tool calls, then dispatches and persists the reply. Separate capabilities cover memory and worldbooks, image and voice generation, MCP tools, plugins, and social moments. The README documents these branches; sampled source confirms manager setup and provider selection, but not every runtime call path.

Main entry points: [`pawzochat/services/chat.py`](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/chat.py) (Chat processing), [`pawzochat/channels`](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/channels) (Message channels), [`pawzochat/app.py`](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/app.py) (Application lifecycle), [`pawzochat/services/reply_dispatcher.py`](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/reply_dispatcher.py) (Reply dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation runtime"]
  node_app["Application lifecycle<br/>[app.py]"]
  node_queue["Message queue<br/>[message_queue.py]"]
  node_chat["Chat processing<br/>[chat.py]"]
  node_reply["Reply dispatch"]
  node_conversation_store[("Conversation store<br/>[conversation.py]")]
end

subgraph group_channels["Channels and transport"]
  node_channel["Message channels"]
  node_transport["Platform transport"]
end

subgraph group_capabilities["AI capabilities"]
  node_llm["LLM providers"]
  node_memory["Memory service<br/>[memory.py]"]
  node_worldbook["Worldbook service<br/>[worldbook.py]"]
  node_image["Image generation"]
  node_voice["Voice synthesis"]
  node_mcp["MCP tools"]
  node_mcp_servers["MCP servers"]
end

subgraph group_web["Web management"]
  node_web_ui["Web panel<br/>[app.js]"]
  node_web_app["Web application<br/>[app.py]"]
  node_web_routes["Management routes"]
end

subgraph group_extensions["Extensions and social"]
  node_moments["Social moments<br/>[moments.py]"]
  node_moments_store[("Moments store<br/>[moments.py]")]
  node_plugins["Plugin runtime<br/>[manager.py]"]
end

node_user(("User"))
node_llm_service["LLM service"]
node_image_service["Image service"]
node_voice_service["TTS service"]

node_user -->|"sends message"| node_channel
node_channel -->|"uses platform"| node_transport
node_channel -->|"accepts message"| node_queue
node_queue -->|"processes round"| node_chat
node_chat -->|"requests inference"| node_llm
node_llm -->|"calls provider"| node_llm_service
node_chat -->|"uses context"| node_memory
node_chat -->|"loads entries"| node_worldbook
node_chat -->|"invokes tools"| node_mcp
node_mcp -->|"calls tools"| node_mcp_servers
node_chat -->|"generates image"| node_image
node_image -->|"calls provider"| node_image_service
node_chat -->|"synthesizes speech"| node_voice
node_voice -->|"calls provider"| node_voice_service
node_chat -->|"produces reply"| node_reply
node_reply -->|"persists messages"| node_conversation_store
node_reply -->|"delivers reply"| node_channel
node_app -->|"wires service"| node_chat
node_app -->|"starts panel"| node_web_app
node_web_ui -->|"requests panel"| node_web_app
node_web_app -->|"registers routes"| node_web_routes
node_web_routes -->|"manages history"| node_conversation_store
node_web_routes -->|"manages memories"| node_memory
node_moments -->|"persists activity"| node_moments_store
node_app -->|"loads plugins"| node_plugins
node_plugins -.->|"registers channel"| node_channel

click node_app "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/app.py"
click node_channel "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/channels"
click node_transport "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/transport"
click node_queue "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/message_queue.py"
click node_chat "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/chat.py"
click node_reply "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/reply_dispatcher.py"
click node_conversation_store "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/store/conversation.py"
click node_llm "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/llm"
click node_memory "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/memory.py"
click node_worldbook "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/worldbook.py"
click node_image "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/image"
click node_voice "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/voice"
click node_mcp "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/mcp"
click node_mcp_servers "https://github.com/iwyxdxl/pawzochat/tree/main/data/mcp_servers"
click node_moments "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/moments.py"
click node_moments_store "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/store/moments.py"
click node_plugins "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/core/extensions/manager.py"
click node_web_ui "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/web/static/app.js"
click node_web_app "https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/web/app.py"
click node_web_routes "https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/web/routes"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_queue,node_chat,node_reply,node_conversation_store,node_user toneBlue
class node_channel,node_transport toneAmber
class node_llm,node_memory,node_worldbook,node_image,node_voice,node_mcp,node_mcp_servers toneMint
class node_web_ui,node_web_app,node_web_routes toneRose
class node_moments,node_moments_store,node_plugins,node_llm_service,node_image_service,node_voice_service toneIndigo
```

## Components

### Conversation runtime

- [Application lifecycle](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/app.py): `pawzochat/app.py`
- [Message queue](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/message_queue.py): `pawzochat/services/message_queue.py`
- [Chat processing](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/chat.py): `pawzochat/services/chat.py`
- [Reply dispatch](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/reply_dispatcher.py): `pawzochat/services/reply_dispatcher.py`
- [Conversation store](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/store/conversation.py): `pawzochat/store/conversation.py`

### Channels and transport

- [Message channels](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/channels): `pawzochat/channels`
- [Platform transport](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/transport): `pawzochat/transport`

### AI capabilities

- [LLM providers](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/llm): `pawzochat/llm`
- [Memory service](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/memory.py): `pawzochat/services/memory.py`
- [Worldbook service](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/worldbook.py): `pawzochat/services/worldbook.py`
- [Image generation](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/image): `pawzochat/image`
- [Voice synthesis](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/voice): `pawzochat/voice`
- [MCP tools](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/mcp): `pawzochat/mcp`
- [MCP servers](https://github.com/iwyxdxl/pawzochat/tree/main/data/mcp_servers): `data/mcp_servers`

### Web management

- [Web panel](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/web/static/app.js): `pawzochat/web/static/app.js`
- [Web application](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/web/app.py): `pawzochat/web/app.py`
- [Management routes](https://github.com/iwyxdxl/pawzochat/tree/main/pawzochat/web/routes): `pawzochat/web/routes`

### Extensions and social

- [Social moments](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/services/moments.py): `pawzochat/services/moments.py`
- [Moments store](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/store/moments.py): `pawzochat/store/moments.py`
- [Plugin runtime](https://github.com/iwyxdxl/pawzochat/blob/main/pawzochat/core/extensions/manager.py): `pawzochat/core/extensions/manager.py`

### Other components

- **User**
- **LLM service**
- **Image service**
- **TTS service**

## Connections

- User → Message channels: sends message
- Message channels → Platform transport: uses platform
- Message channels → Message queue: accepts message
- Message queue → Chat processing: processes round
- Chat processing → LLM providers: requests inference
- LLM providers → LLM service: calls provider
- Chat processing → Memory service: uses context
- Chat processing → Worldbook service: loads entries
- Chat processing → MCP tools: invokes tools
- MCP tools → MCP servers: calls tools
- Chat processing → Image generation: generates image
- Image generation → Image service: calls provider
- Chat processing → Voice synthesis: synthesizes speech
- Voice synthesis → TTS service: calls provider
- Chat processing → Reply dispatch: produces reply
- Reply dispatch → Conversation store: persists messages
- Reply dispatch → Message channels: delivers reply
- Application lifecycle → Chat processing: wires service
- Application lifecycle → Web application: starts panel
- Web panel → Web application: requests panel
- Web application → Management routes: registers routes
- Management routes → Conversation store: manages history
- Management routes → Memory service: manages memories
- Social moments → Moments store: persists activity
- Application lifecycle → Plugin runtime: loads plugins
- Plugin runtime → Message channels: registers channel
