AI Customer-Service Agent for E-commerce

2025.10 – Present · Company project · Java, Electron, Vue 3, C#

Yizhi AI Customer Service is an automatic reception system for e-commerce merchants. A merchant logs in to the customer service accounts of Pinduoduo, Qianniu (Taobao), JD.com, Kuaishou, Douyin and Xianyu in a Windows desktop client. The client reads customer messages, calls a cloud Agent to generate a reply, and sends it back to the platform. Once a reply is delivered, it is billed in points. This is a company (Yizhi) project. The repositories are under the GitHub organization yizhi-aicare. It started in 2025-05 and is still running. I am one of the core developers.

All screenshots below were rendered locally with demo data. The shops, customers, channels and call volumes are fictional.

My place in the project

The project has three repositories, plus a workspace repository for engineering rules and architecture docs. I joined in 2025-10. The table counts commits on the default branch, excluding merge commits.

Repository Content My commits / all What I own
aicare-support Electron + Vue 3 desktop client, C# native engine 1089 / 2643 Reception orchestration runner, Qianniu native engine, releases
aicare-support-backend Spring Boot backend 939 / 1644 V2 chat and Agent, model layer, billing, transfer v3, operations assistant
aicare-support-website Website, merchant console, platform admin, agent (reseller) portal 220 / 246 All console pages
aicare-workspace Rules, architecture docs, deploy scripts 316 / 325 Engineering rules and docs

The three product repositories total 2248 / 4533 commits, about half. The early V1 phase (2025-05 to 2025-09) and the first adapters for each platform were mostly done by other members. By committer email, 30 commits in the desktop repository and 24 in the backend are from before I joined.

Architecture

Architecture

How one reception works:

  1. The desktop client runs one worker per customer service account. The runner scans conversations on a timer. Messages from the same customer are handled serially; different customers run in parallel.
  2. The platform adapter layer reads the conversation and recent messages. Pinduoduo, JD.com, Kuaishou, Douyin and Xianyu use injected scripts. Qianniu uses C# UI Automation to drive the client window, and Electron loads the C# code through edge-js.
  3. The client sends POST /api/v2/chat/stream with the conversation ID and the customer message.
  4. The backend judges the complexity and the capabilities needed, and runs the AgentLoop. When needed it calls tools such as knowledge retrieval, lookup tables, registration tables, after-sales tickets and handoff to a human.
  5. The reply is written to the database before the final content is sent to the client. After the client sends it successfully, it calls POST /api/v2/chat/ack, and the backend deducts points in one PostgreSQL transaction.

Shop customer service page: customer service accounts are managed per shop, and each shop is bound to one AI plan

Evolution

The old version was a Java chain of responsibility plus injected platform scripts, with orchestration described in a DSL. The current structure came from several rewrites:

Time Change
2026-02 Introduced event-orchestrator: a single-flow AutoReplyRunner at its core, no general DSL orchestration engine, keeping per-customer serial handling and three plugin points
2026-05 Backend chat rewritten: chat_turn state machine, AgentLoop, true streaming SSE, message-level history. The V2 knowledge base and V2 model layer were added the same month
2026-06 Qianniu supports multi-account workers, with native calls of all accounts serialized in the process; started building the operations assistant
2026-07 Transfer v3: shop, agent and transfer target are separate layers; the Qianniu native engine moved from its own repository into the desktop repository; trial of a unified RPA engine
2026-08 to 10 Removed the V1 chat entry and leftover stacks such as products and tools
2026-09 The server no longer holds the conversation ledger; the reply path is unified on /chat/stream

Hard parts

Reply, delivery and billing must agree. A generated reply may fail to send, and the client may send the same ACK twice. chat_turn records the state, and points are deducted only on ACK. The deduction uses CHAT_REPLY:<requestId> as an idempotency key, so a repeated ACK does not deduct again. A turn where the model produced no customer-visible text is marked as failed and is not billed. The generation timeouts have a strict order: 30 seconds per model call, 180 seconds for the backend, 195 seconds for the desktop HTTP request, 360 seconds for the conversation lock. Changing one value means updating the desktop contract tests too.

Execution is layered by question difficulty. One classification call returns a complexity score and the capabilities needed. It then picks one of four execution modes: a low-score question that needs only knowledge does one fixed retrieval and then answers; a question that needs no capability is answered directly; a medium score or a business action gets one round of tools at most; a high score runs the full Agent. The retrieval query is always the customer's original sentence. In evaluation, having the model rewrite the question before retrieval produced more hallucinations than the original sentence.

Model layer. Configuration has five layers: channel, deployment, logical model, model group, tier. Within a tier, traffic is split by weight and health. It falls to the next tier only when the whole tier is unavailable. Each deployment has a circuit breaker. Protocol adapters wrap OpenAI Chat, Responses, Anthropic and other protocols, and business code only declares the capabilities it needs.

Model group routing: deployments in the same tier are split by weight, and a fully unavailable tier falls to the next one

Call trend and reply performance monitoring

Multi-platform automation. The platform adapter layer has 7 core methods that every platform must implement, plus optional capabilities such as sending images, orders and transfer, which degrade when missing. The lifecycle of the Qianniu transfer dialog belongs only to the native engine; Electron handles only the business transaction and retries. Agent (seat) identities are issued by the backend and not generated on the client, so several accounts in the same shop do not collide on IDs.

Merchant-side settings

A merchant binds one AI plan to each shop: agent persona, knowledge base, lookup and registration tables, keyword replies, payment reminders and transfer. Intelligence level has four tiers, matching the routing tiers in the backend.

AI plan home: health score, average time, reply failures and handoff-to-human count

Agent persona and intelligence level

Chat records replay each turn of a conversation, including tool calls and timing.

Chat records: the time and tool calls of each reply can be inspected

In the platform admin, routing plans split complexity into tiers from 1 to 10. Each tier sets a model group, reasoning effort, maximum tool rounds and a billing mode. Tier routing has a master switch. When it is off, all plans go back to the old path.

Platform admin: routing plans and the tier routing switch

Scale

The backend has 1119 main Java files, about 157,000 lines, and 396 test files. The desktop client has 126 Vue components, 294 TypeScript files and about 14,000 lines of C# native code. The website has 93 Vue components. Counted on 2026-11-20.