Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# AgentDesk single-merchant deployment environment template.
# Copy to .env.production for each merchant and keep that file out of git.
#
# Generate secrets with commands such as:
# openssl rand -base64 24
# openssl rand -base64 32

# Required: first admin password used by bootstrap login.
# Do not use ChangeMe123! in production.
AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD=

# Required: signing secret for customer chat sessions.
AGENT_DESK_CUSTOMERSESSION_SECRET=

# Required when using docker-compose.yml or docker-compose.lancedb.yml MySQL service.
AGENT_DESK_MYSQL_PASSWORD=
AGENT_DESK_MYSQL_ROOT_PASSWORD=

# Optional: use an external merchant database instead of the compose MySQL service.
# Leave empty when using the compose default MySQL service.
# Example:
# AGENT_DESK_DB_DSN=user:password@tcp(mysql-host:3306)/merchant_db?charset=utf8mb4&parseTime=True&multiStatements=true&loc=Local
AGENT_DESK_DB_DSN=

# Optional but recommended: outbound notification webhook for high-intent leads,
# appointment leads, conversation assignment, and human-handoff alerts.
AGENT_DESK_NOTIFY_WEBHOOK_ENABLED=false
AGENT_DESK_NOTIFY_WEBHOOK_URL=
AGENT_DESK_NOTIFY_WEBHOOK_FORMAT=generic
AGENT_DESK_NOTIFY_WEBHOOK_SECRET=
AGENT_DESK_NOTIFY_DAILYREPORT_ENABLED=false
AGENT_DESK_NOTIFY_DAILYREPORT_CRON="0 9 * * *"
AGENT_DESK_NOTIFY_DAILYREPORT_DATEOFFSETDAYS=0
AGENT_DESK_NOTIFY_DAILYREPORT_ALLOWDUPLICATE=false

# Optional: acceptance script connection info.
AGENT_DESK_BASE_URL=http://127.0.0.1:8083
AGENT_DESK_ADMIN_USERNAME=admin
AGENT_DESK_ADMIN_PASSWORD=
MUSE_ACCEPTANCE_TIMEOUT_MS=70000
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ data/
config/config.yaml
include/
lib/
!web/lib/
!web/lib/api/
!web/lib/api/config.ts

dist/
__debug_bin*
Expand All @@ -18,4 +21,4 @@ node_modules/

agent-desk

test-reports
test-reports
2 changes: 1 addition & 1 deletion cmd/testdata/agentteam/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func createOrGetUser(ctx *sqls.TxContext, username, nickname string) (int64, boo
}

// 创建新用户
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(constants.BootstrapAdminPassword), bcrypt.DefaultCost)
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(constants.BootstrapAdminInitialPassword()), bcrypt.DefaultCost)
if err != nil {
return 0, false, err
}
Expand Down
29 changes: 29 additions & 0 deletions config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,35 @@ mcp:
# Extra HTTP headers sent to this MCP server on every request, for example Authorization or tenant headers.
headers: {}

notify:
webhook:
# Generic outbound webhook for high-intent leads, appointment leads, and human-handoff/assignment alerts.
# Keep disabled unless a merchant-specific endpoint is configured.
enabled: false
# Endpoint examples: a self-hosted CRM receiver, n8n webhook, WeCom group robot, DingTalk robot, or Feishu bot.
url: ""
# Supported values:
# - generic/json: {"eventType","title","content","text","metadata","timestamp"}
# - wecom_robot/dingtalk/text: {"msgtype":"text","text":{"content":"..."}}
# - feishu/lark: {"msg_type":"text","content":{"text":"..."}}
format: generic
# Optional HMAC-SHA256 signing secret for self-hosted receivers.
# When set, requests include X-Agent-Desk-Timestamp and X-Agent-Desk-Signature headers.
secret: ""
# Request timeout in milliseconds. Values <= 0 fall back to 5000.
timeoutMs: 5000
# Optional static headers, for example Authorization for a self-hosted receiver.
headers: {}
dailyReport:
# Whether to send the daily business report to the configured notify.webhook on a schedule.
enabled: false
# Standard 5-field cron expression. Default: 09:00 every day.
cron: "0 9 * * *"
# 0 sends today's report; -1 sends yesterday's report.
dateOffsetDays: 0
# false prevents the scheduled job from sending the same report date more than once.
allowDuplicate: false

oidc:
# Whether to enable OIDC login. This system acts as the OIDC client.
enabled: false
Expand Down
11 changes: 9 additions & 2 deletions docker-compose.lancedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
environment:
MYSQL_DATABASE: cs_ai_agent
MYSQL_USER: cs_ai_agent
MYSQL_PASSWORD: cs_ai_agent_password
MYSQL_ROOT_PASSWORD: cs_ai_agent_root_password
MYSQL_PASSWORD: "${AGENT_DESK_MYSQL_PASSWORD:-cs_ai_agent_password}"
MYSQL_ROOT_PASSWORD: "${AGENT_DESK_MYSQL_ROOT_PASSWORD:-cs_ai_agent_root_password}"
TZ: Asia/Shanghai
command:
- --character-set-server=utf8mb4
Expand Down Expand Up @@ -38,6 +38,13 @@ services:
- ./docker/agent-desk-lancedb.yaml:/app/config/config.yaml:ro
environment:
TZ: Asia/Shanghai
AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD: "${AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD:-}"
AGENT_DESK_CUSTOMERSESSION_SECRET: "${AGENT_DESK_CUSTOMERSESSION_SECRET:-}"
AGENT_DESK_DB_DSN: "${AGENT_DESK_DB_DSN:-cs_ai_agent:${AGENT_DESK_MYSQL_PASSWORD:-cs_ai_agent_password}@tcp(mysql:3306)/cs_ai_agent?charset=utf8mb4&parseTime=True&multiStatements=true&loc=Local}"
AGENT_DESK_NOTIFY_WEBHOOK_ENABLED: "${AGENT_DESK_NOTIFY_WEBHOOK_ENABLED:-false}"
AGENT_DESK_NOTIFY_WEBHOOK_URL: "${AGENT_DESK_NOTIFY_WEBHOOK_URL:-}"
AGENT_DESK_NOTIFY_WEBHOOK_FORMAT: "${AGENT_DESK_NOTIFY_WEBHOOK_FORMAT:-generic}"
AGENT_DESK_NOTIFY_WEBHOOK_SECRET: "${AGENT_DESK_NOTIFY_WEBHOOK_SECRET:-}"

volumes:
mysql-data:
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.sqlite-lancedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ services:
- ./data:/app/data
environment:
TZ: Asia/Shanghai
AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD: "${AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD:-}"
AGENT_DESK_CUSTOMERSESSION_SECRET: "${AGENT_DESK_CUSTOMERSESSION_SECRET:-}"
AGENT_DESK_NOTIFY_WEBHOOK_ENABLED: "${AGENT_DESK_NOTIFY_WEBHOOK_ENABLED:-false}"
AGENT_DESK_NOTIFY_WEBHOOK_URL: "${AGENT_DESK_NOTIFY_WEBHOOK_URL:-}"
AGENT_DESK_NOTIFY_WEBHOOK_FORMAT: "${AGENT_DESK_NOTIFY_WEBHOOK_FORMAT:-generic}"
AGENT_DESK_NOTIFY_WEBHOOK_SECRET: "${AGENT_DESK_NOTIFY_WEBHOOK_SECRET:-}"
11 changes: 9 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
environment:
MYSQL_DATABASE: cs_ai_agent
MYSQL_USER: cs_ai_agent
MYSQL_PASSWORD: cs_ai_agent_password
MYSQL_ROOT_PASSWORD: cs_ai_agent_root_password
MYSQL_PASSWORD: "${AGENT_DESK_MYSQL_PASSWORD:-cs_ai_agent_password}"
MYSQL_ROOT_PASSWORD: "${AGENT_DESK_MYSQL_ROOT_PASSWORD:-cs_ai_agent_root_password}"
TZ: Asia/Shanghai
command:
- --character-set-server=utf8mb4
Expand Down Expand Up @@ -46,6 +46,13 @@ services:
- ./docker/agent-desk.yaml:/app/config/config.yaml:ro
environment:
TZ: Asia/Shanghai
AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD: "${AGENT_DESK_BOOTSTRAP_ADMIN_PASSWORD:-}"
AGENT_DESK_CUSTOMERSESSION_SECRET: "${AGENT_DESK_CUSTOMERSESSION_SECRET:-}"
AGENT_DESK_DB_DSN: "${AGENT_DESK_DB_DSN:-cs_ai_agent:${AGENT_DESK_MYSQL_PASSWORD:-cs_ai_agent_password}@tcp(mysql:3306)/cs_ai_agent?charset=utf8mb4&parseTime=True&multiStatements=true&loc=Local}"
AGENT_DESK_NOTIFY_WEBHOOK_ENABLED: "${AGENT_DESK_NOTIFY_WEBHOOK_ENABLED:-false}"
AGENT_DESK_NOTIFY_WEBHOOK_URL: "${AGENT_DESK_NOTIFY_WEBHOOK_URL:-}"
AGENT_DESK_NOTIFY_WEBHOOK_FORMAT: "${AGENT_DESK_NOTIFY_WEBHOOK_FORMAT:-generic}"
AGENT_DESK_NOTIFY_WEBHOOK_SECRET: "${AGENT_DESK_NOTIFY_WEBHOOK_SECRET:-}"

volumes:
mysql-data:
Expand Down
9 changes: 9 additions & 0 deletions docker/agent-desk-lancedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ mcp:
timeoutMs: 60000
headers: {}

notify:
webhook:
enabled: false
url: ""
format: generic
secret: ""
timeoutMs: 5000
headers: {}

wxWork:
enabled: false

Expand Down
9 changes: 9 additions & 0 deletions docker/agent-desk-sqlite-lancedb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ mcp:
timeoutMs: 60000
headers: {}

notify:
webhook:
enabled: false
url: ""
format: generic
secret: ""
timeoutMs: 5000
headers: {}

wxWork:
enabled: false
corpId: ""
Expand Down
9 changes: 9 additions & 0 deletions docker/agent-desk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ mcp:
timeoutMs: 15000
headers: {}

notify:
webhook:
enabled: false
url: ""
format: generic
secret: ""
timeoutMs: 5000
headers: {}

wxWork:
enabled: false
corpId: ""
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ require (
golang.org/x/crypto v0.53.0
golang.org/x/net v0.56.0
golang.org/x/oauth2 v0.36.0
golang.org/x/text v0.38.0
golang.org/x/tools v0.46.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.7
gorm.io/driver/sqlite v1.5.7
gorm.io/gorm v1.25.12
)

require (
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/text v0.38.0 // indirect
)

require (
Expand Down
Loading