2026-05-18 19:26:16 +08:00
2026-03-31 17:24:37 +08:00
2026-05-18 19:26:16 +08:00
2026-05-18 13:19:46 +08:00
2026-05-18 19:26:16 +08:00
2026-03-31 14:01:31 +08:00
2026-05-18 19:26:16 +08:00
2025-12-08 16:17:56 +08:00
2026-02-02 21:41:47 +08:00
2025-12-08 15:55:41 +08:00
2026-05-18 19:14:59 +08:00
2026-05-18 19:13:31 +08:00

English | 中文

GitHub stars Forks License: MIT Go Next.js MySQL

AI-CS — Intelligent Customer Service

Open-source AI customer service: AI + human agents, self-hostable, configurable, observable.
Ship a website chat widget and an agent dashboard together.

Table of Contents

Preview

Marketing homepage

Homepage

Visitor chat widget

Human agent mode
Human mode
AI mode
AI mode

Live Demo

Features

  • Visitor widget (embeddable)
    • Bottom-right chat window via iframe or widget.js
    • AI / human mode, sound notifications, file uploads
    • Optional per-turn web search (visibility configurable in admin)
  • Agent dashboard
    • Conversation list, WebSocket messaging, unread badges
    • Visitor IP & approximate region (ip2region, offline)
    • Live typing draft sync between visitor and agent
    • Multi-model setup (text / image), prompts, knowledge base + RAG
    • Log center, analytics (widget opens, messages, AI success rate, etc.)
  • Marketing site & SEO — metadata, OG, sitemap, robots.txt
  • Optional web search — Serper (API or MCP) or provider-native search

Project Structure

AI-CS/
├── backend/                    # Go: API, WebSocket, AI, RAG
│   ├── controller/
│   ├── service/
│   ├── repository/
│   ├── models/
│   ├── infra/                  # DB, Milvus, ip2region, storage
│   ├── websocket/
│   ├── router/
│   ├── data/                   # ip2region xdb (optional)
│   └── main.go
├── frontend/                   # Next.js: site, widget, agent UI
│   ├── app/
│   ├── components/
│   ├── features/
│   └── public/widget.js
├── doc/
├── scripts/
├── assets/readme/
├── docker-compose.yml
├── docker-compose.prod.yml
└── .env.example

Quick Start (root /.env only)

Copy .env.example to .env and set at least: MYSQL_ROOT_PASSWORD, DB_PASSWORD, ADMIN_PASSWORD, ENCRYPTION_KEY (64-char hex).

git clone https://github.com/2930134478/AI-CS.git
cd AI-CS
cp .env.example .env
# edit .env, then:
docker-compose -f docker-compose.prod.yml up -d

Option B — Build with Docker Compose

docker-compose up -d --build

Option C — Local dev

  • Go 1.24+, Node 20.9+, MySQL 8.0+
  • go run main.go in backend/, npm run dev in frontend/

See the Chinese README for demo-site admin policies, port notes, and full deployment details.

Configuration (root /.env)

Full variable reference is in .env.example and the Chinese README configuration table.

Required for most deployments: database credentials, ADMIN_PASSWORD, ENCRYPTION_KEY, and (for production frontends) NEXT_PUBLIC_API_BASE_URL.

Knowledge Base (RAG)

  • Disable Milvus: MILVUS_DISABLED=true — app still runs; RAG off
  • Strict dependency: MILVUS_REQUIRED=true — exit if Milvus is unavailable

Multi-Instance WebSocket (Redis)

Configure REDIS_URL (or REDIS_ADDR + password) so WebSocket events sync across replicas. Single instance works without Redis.

Embed Widget (iframe)

Paste before </body>. Point iframe src to https://your-domain/chat. The page auto-detects iframe embed mode (no double floating button). See Chinese README for the full HTML snippet, or use frontend/public/widget.js.

Documentation

  • None

FAQ & Troubleshooting

  • No sound — browser needs a user gesture before audio
  • Milvus startup failure — check MILVUS_REQUIRED; use MILVUS_DISABLED=true if you do not need RAG
  • SEO / OG wrong — set NEXT_PUBLIC_SITE_URL
  • “Init failed” / MySQLcurl :18080/health, docker logs ai-cs-backend; in Docker use DB_HOST=mysql

Star History

Star History Chart

Contributing

Issues and PRs welcome. For bugs, include deployment method, backend logs, and redacted .env keys.

License

MIT © 2025 2930134478

S
Description
No description provided
Readme MIT 5.2 MiB
Languages
TypeScript 57.8%
Go 40.3%
JavaScript 0.8%
CSS 0.5%
Shell 0.3%
Other 0.3%