# gudong2003/xianyu-auto-reply-fix architecture

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

- Interactive diagram: https://gitdiagram.com/gudong2003/xianyu-auto-reply-fix
- Repository: https://github.com/gudong2003/xianyu-auto-reply-fix

## Overview

This is a FastAPI-based multi-user Xianyu seller-management system. The principal workflow is: a user operates the web interface, account management starts per-account live message processing, and the system handles replies and operational events while persisting account and business data. Separate capabilities cover product discovery and publishing, order management, fulfillment, ratings, notifications, and monitoring. The README documents the overall runtime flow; several feature modules are represented from their names and index references, so uncertain wiring is omitted.

Main entry points: [`db_manager.py`](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/db_manager.py) (SQLite Data), [`Start.py`](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/Start.py) (Web Interface), [`cookie_manager.py`](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/cookie_manager.py) (Account Manager), [`XianyuAutoAsync.py`](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/XianyuAutoAsync.py) (Live Message Runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and Accounts"]
  node_webapp["Web Interface<br/>[Start.py]"]
  node_account_mgr["Account Manager<br/>[cookie_manager.py]"]
  node_config["Runtime Config<br/>[config.py]"]
end

subgraph group_messaging["Messaging Runtime"]
  node_live["Live Message Runtime<br/>[XianyuAutoAsync.py]"]
  node_ai["AI Replies<br/>[ai_reply_engine.py]"]
  node_filters["Message Filters"]
  node_blacklist["Blacklist"]
end

subgraph group_commerce["Commerce Operations"]
  node_products["Product Search<br/>[item_search.py]"]
  node_publisher["Product Publishing<br/>[item_publisher.py]"]
  node_sku["Product Specs<br/>[product_sku.py]"]
  node_order_status["Order Status"]
  node_order_sync["Order History Sync"]
  node_order_details["Order Details"]
  node_fulfillment["Auto Fulfillment"]
  node_rating_task["Rating Task<br/>[auto_rate_task.py]"]
  node_rating["Rating Service<br/>[rate_service.py]"]
  node_redflower["Red Flower Task"]
end

subgraph group_platform["Platform Services"]
  node_notify["Notifications"]
  node_events["Order Events<br/>[order_event_hub.py]"]
  node_logs["Live Logs"]
end

subgraph group_state["Persistence and Monitoring"]
  node_database[("SQLite Data<br/>[db_manager.py]")]
end

node_seller(("Seller"))
node_xianyu(("Xianyu Platform"))

node_seller -->|"uses"| node_webapp
node_webapp -->|"manages accounts"| node_account_mgr
node_webapp -->|"loads"| node_config
node_webapp -->|"initializes"| node_database
node_webapp -->|"initializes"| node_logs
node_account_mgr -->|"reads and writes"| node_database
node_account_mgr -->|"starts account runtime"| node_live
node_live -.->|"generates replies"| node_ai
node_live -.->|"streams logs"| node_logs
node_ai -->|"reads settings"| node_database
node_filters -->|"uses rules"| node_database
node_blacklist -->|"uses records"| node_database
node_order_status -->|"updates orders"| node_database
node_order_status -->|"publishes events"| node_events
node_order_sync -->|"fetches details"| node_order_details
node_order_sync -->|"syncs history"| node_database
node_order_details -->|"stores details"| node_database
node_rating_task -->|"calls service"| node_rating
node_rating -->|"updates cookies"| node_database
node_publisher -->|"uses specs"| node_sku
node_rating -->|"submits ratings"| node_xianyu
node_redflower -.->|"requests flowers"| node_xianyu
node_fulfillment -.->|"fulfills orders"| node_xianyu
node_products -.->|"searches products"| node_xianyu
node_publisher -.->|"publishes listings"| node_xianyu
node_notify -->|"reads notification settings"| node_database
node_events -->|"uses order data"| node_database

click node_webapp "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/Start.py"
click node_account_mgr "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/cookie_manager.py"
click node_config "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/config.py"
click node_live "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/XianyuAutoAsync.py"
click node_ai "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/ai_reply_engine.py"
click node_filters "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/message_filter_service.py"
click node_blacklist "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/blacklist_service.py"
click node_products "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/item_search.py"
click node_publisher "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/item_publisher.py"
click node_sku "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/product_sku.py"
click node_order_status "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/order_status_handler.py"
click node_order_sync "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/order_history_sync.py"
click node_order_details "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/order_detail_fetcher.py"
click node_fulfillment "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/secure_freeshipping_decrypted.py"
click node_rating_task "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/auto_rate_task.py"
click node_rating "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/rate_service.py"
click node_redflower "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/auto_red_flower_task.py"
click node_notify "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/notification_dispatcher.py"
click node_events "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/order_event_hub.py"
click node_logs "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/file_log_collector.py"
click node_database "https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/db_manager.py"

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_webapp,node_account_mgr,node_config toneBlue
class node_live,node_ai,node_filters,node_blacklist toneAmber
class node_products,node_publisher,node_sku,node_order_status,node_order_sync,node_order_details,node_fulfillment,node_rating_task,node_rating,node_redflower toneMint
class node_notify,node_events,node_logs toneRose
class node_database,node_seller,node_xianyu toneIndigo
```

## Components

### Web and Accounts

- [Web Interface](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/Start.py): `Start.py`
- [Account Manager](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/cookie_manager.py): `cookie_manager.py`
- [Runtime Config](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/config.py): `config.py`

### Messaging Runtime

- [Live Message Runtime](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/XianyuAutoAsync.py): `XianyuAutoAsync.py`
- [AI Replies](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/ai_reply_engine.py): `ai_reply_engine.py`
- [Message Filters](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/message_filter_service.py): `message_filter_service.py`
- [Blacklist](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/blacklist_service.py): `blacklist_service.py`

### Commerce Operations

- [Product Search](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/item_search.py): `utils/item_search.py`
- [Product Publishing](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/item_publisher.py): `utils/item_publisher.py`
- [Product Specs](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/product_sku.py): `utils/product_sku.py`
- [Order Status](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/order_status_handler.py): `order_status_handler.py`
- [Order History Sync](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/order_history_sync.py): `utils/order_history_sync.py`
- [Order Details](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/order_detail_fetcher.py): `utils/order_detail_fetcher.py`
- [Auto Fulfillment](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/secure_freeshipping_decrypted.py): `secure_freeshipping_decrypted.py`
- [Rating Task](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/auto_rate_task.py): `auto_rate_task.py`
- [Rating Service](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/rate_service.py): `utils/rate_service.py`
- [Red Flower Task](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/auto_red_flower_task.py): `auto_red_flower_task.py`

### Platform Services

- [Notifications](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/utils/notification_dispatcher.py): `utils/notification_dispatcher.py`
- [Order Events](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/order_event_hub.py): `order_event_hub.py`
- [Live Logs](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/file_log_collector.py): `file_log_collector.py`

### Persistence and Monitoring

- [SQLite Data](https://github.com/gudong2003/xianyu-auto-reply-fix/blob/main/db_manager.py): `db_manager.py`

### Other components

- **Seller**
- **Xianyu Platform**

## Connections

- Seller → Web Interface: uses (evidence: `README.md`)
- Web Interface → Account Manager: manages accounts (evidence: `README.md`)
- Web Interface → Runtime Config: loads (evidence: `Start.py`)
- Web Interface → SQLite Data: initializes (evidence: `Start.py`)
- Web Interface → Live Logs: initializes (evidence: `Start.py`)
- Account Manager → SQLite Data: reads and writes (evidence: `cookie_manager.py`)
- Account Manager → Live Message Runtime: starts account runtime (evidence: `cookie_manager.py`)
- Live Message Runtime → AI Replies: generates replies (evidence: `README.md`)
- Live Message Runtime → Live Logs: streams logs (evidence: `README.md`)
- AI Replies → SQLite Data: reads settings (evidence: `ai_reply_engine.py`)
- Message Filters → SQLite Data: uses rules (evidence: `message_filter_service.py`)
- Blacklist → SQLite Data: uses records (evidence: `blacklist_service.py`)
- Order Status → SQLite Data: updates orders (evidence: `order_status_handler.py`)
- Order Status → Order Events: publishes events (evidence: `order_status_handler.py`)
- Order History Sync → Order Details: fetches details (evidence: `utils/order_history_sync.py`)
- Order History Sync → SQLite Data: syncs history (evidence: `utils/order_history_sync.py`)
- Order Details → SQLite Data: stores details (evidence: `utils/order_detail_fetcher.py`)
- Rating Task → Rating Service: calls service (evidence: `auto_rate_task.py`)
- Rating Service → SQLite Data: updates cookies (evidence: `utils/rate_service.py`)
- Product Publishing → Product Specs: uses specs (evidence: `utils/item_publisher.py`)
- Rating Service → Xianyu Platform: submits ratings (evidence: `utils/rate_service.py`)
- Red Flower Task → Xianyu Platform: requests flowers (evidence: `README.md`)
- Auto Fulfillment → Xianyu Platform: fulfills orders (evidence: `README.md`)
- Product Search → Xianyu Platform: searches products (evidence: `README.md`)
- Product Publishing → Xianyu Platform: publishes listings (evidence: `README.md`)
- Notifications → SQLite Data: reads notification settings (evidence: `utils/notification_dispatcher.py`)
- Order Events → SQLite Data: uses order data (evidence: `order_event_hub.py`)
