365 Commits
Author SHA1 Message Date
rogee 4d684a71eb feat: geolocate anonymous widget visitors
Build and publish Docker images / Build and publish images (push) Successful in 2m10s
2026-09-15 08:54:13 +08:00
rogee 4ad56ee9f8 Publish current project state 2026-09-14 10:47:21 +08:00
rogee 0dd188c46f feat: complete current GoChat updates 2026-09-13 00:13:55 +08:00
rogee 31f157a4f5 feat(shangwutong): sync classifications and update conversations 2026-09-11 17:08:18 +08:00
Rogeeandrogee df83d04ce6 docs(HH-626): align Redis claim retry semantics (#171)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-24 17:01:17 +08:00
Rogeeandrogee 4455f8938d HH-574: enforce stale job claim limit (#168)
* fix(HH-574): enforce stale job claim limit

* fix(HH-574): guard exhausted retry claims

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-24 16:46:35 +08:00
Rogeeandrogee 3d91da8231 docs(HH-575): clarify per-target enqueue failure (#167)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-24 15:57:44 +08:00
Rogeeandrogee d4036a2074 docs(HH-570): clarify realtime relay boundaries (#143)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-24 00:14:21 +08:00
Rogeeandrogee e1ae9b57d8 docs(HH-566): define realtime replay contract (#140)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-23 23:47:43 +08:00
rogee 25ef9ae494 fix(deploy): reuse shared redis and serve dashboard at root 2026-08-23 17:32:02 +08:00
Rogeeandrogee c86744d326 docs: update production config references (HH-465) (#103)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-22 21:20:11 +08:00
Rogeeandrogee fb83285617 HH-445: deploy production observability and runbooks (#96)
* HH-445: deploy production observability and runbooks

* fix(ops): share production database DSN

* fix(HH-445): enforce database TLS gate

* fix(HH-445): preserve production serve command

* fix(prod): require external database dependencies

* fix(prod): unify database host rejection gates

* test(prod): enforce exact database TLS runbook contract

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-22 19:39:57 +08:00
Rogeeandrogee f719529d66 fix(security): harden auth and secret handling (HH-444) (#101)
* fix(security): harden auth and credential handling (HH-444)

* fix(security): address HH-444 review blockers

* fix(security): close remaining HH-444 review blockers

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-22 15:45:06 +08:00
Rogeeandrogee 6d6d80dd86 HH-441: harden durable storage and recovery (#92)
* HH-441: harden durable storage and recovery

* HH-441: clear recovery review blockers

* HH-441: enforce offsite backup failure domain

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-22 02:16:02 +08:00
Rogeeandrogee c922460649 H-97: fix Shangwutong conversation routing (#16)
* H-60: harden Captain migration rollback and concurrency

* chore(agent): baseline — uncommitted work from the local directory

* fix: route Shangwutong events by display id

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-14 14:35:12 +08:00
Rogeeandrogee d00ea39f6c fix(shangwutong): map kind 24 contact cid (#12)
Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-13 19:27:26 +08:00
Rogee b78f963472 chore: 提交剩余开发改动
包含商务通消息映射、会话时间与未读状态、前端消息展示、数据库修复迁移、测试覆盖备份及 Captain 设计文档。
2026-08-06 10:10:25 +08:00
Rogee 3d7ff5a6b1 chore: complete Shangwutong connector integration 2026-08-04 18:00:10 +08:00
rogee 897b4e018f feat(channels): add Shangwutong connector 2026-08-03 10:13:40 +08:00
Rogee 1446cfe701 feat(channels): 社交渠道 OAuth 改进 + 集成应用重命名 + AI 流程文档
- Facebook/Instagram/TikTok 渠道 OAuth 授权流程改进
- 新增 oauth/credentialstore 包
- 集成应用 OpenAI 重命名为 OpenAI 兼容 (migration 061)
- 消息生命周期与 AI 流程架构文档
- inbox 管理界面 i18n 更新
2026-08-01 19:38:27 +08:00
Rogee 92f0d51375 refactor: 统一 DB/Redis 配置为 DSN 模式 + 移除 Helm/K8s 部署
- DatabaseConfig: Host/Port/User/Password/Name/DBName/SSLMode → 单个 DSN 字段
- RedisConfig: Host/Port/Password/DB/URL → 单个 DSN 字段
- 环境变量: GOCHAT_DATABASE_* (7个) → GOCHAT_DATABASE_DSN, GOCHAT_REDIS_* (5个) → GOCHAT_REDIS_DSN
- validator.go: DSN URL 解析校验 (scheme + host)
- redis.go: redis.ParseURL(cfg.DSN) 直连
- 所有 docker-compose / CI / shell 脚本 / .env 同步更新
- 删除 deploy/helm/ 整个目录 (20个文件)
- CI 删除 helm-validate / deploy-staging / deploy-production 三个 job
- 文档同步更新 (README, 架构设计, PRD, 滚动升级)
2026-07-29 20:58:10 +08:00
Rogee 9f354b503c docs: 写入全量回归测试执行计划 §15
新增 §15 全量回归测试执行计划(按钮/表单级),包含:

Phase 0: 预检查 5 步
Phase 1: Auth 登录详细表单验证
Phase 2: Dashboard + 会话 15 项操作
Phase 3: 侧边栏 14 页导航
Phase 4: Settings 22 页表单级验证
Phase 5: CRM 10 步操作
Phase 6: Widget SDK 7 步
Phase 7: Captain/AI 9 项
Phase 8: Conversation API 15 操作
Phase 9: AgentBot 链路 9 步
Phase 10: 搜索/通知/用户菜单 7 步

每项精确到按钮点击、表单输入、下拉选择、toggle 开关。
2026-07-29 00:14:29 +08:00
Rogee ab9f8c35b5 qa: 修正 5 项评估误解 — 后端未实现降为 0
原标记为后端未实现的 5 项经深度代码溯源 + API 验证确认均为可用:
- Billing: limits 200  subscription/checkout/checkout 全部注册
- Emoji Reactions: 纯前端能力,Chatwoot 无独立 API
- Custom Views: 使用 custom_filters 路径,已实现 200 
- Multi-tab Sync: WebSocket /cable 已就绪
- Conversation Workflows: 纯 UI 组件,数据走 account API

后端功能完成度: 93/93 = 100%
2026-07-28 23:15:03 +08:00
Rogee 5f1bc09b39 qa: 第二轮回归最终覆盖矩阵 — §14 交付验证
Settings 22 页全部 CDP 验证通过:
- 会话工作流: Auto-resolve toggle 
- Copilot 配置: Provider/Model/Feature 
- SLA: Smoke SLA 条目 (FRT=5m NRT=10m RT=1h) 
- 安全: SAML SSO disabled 降级态 

最终交付统计:
- 测试点 93 个, 通过 88 (95%)
- BUG 修复 10 个 (+2 本轮)
- 新增功能 2 个 (fake:ai + LLM auto-reply)
- 新增测试用例 47 项
- 生产阻塞项 0

关键链路全部生产级验证通过:
Auth→Dashboard / Widget→Static AR / Widget→LLM AR
AgentBot CRUD / Conversation 14 操作 / Settings 全导航
Reports / Search / CRM / Widget SDK / 文件上传
2026-07-28 22:09:02 +08:00
Rogee dccd4b93f7 fix: 修复第二轮回归发现的已知 BUG
## 修复清单

### 后端路由修复
1.  — 新增 GET 路由与现有 POST 并存
   - 前端 widget.html 原使用 GET 调用但路由仅注册 POST,导致 404
   - 修复: 注册 GET + POST 双路由,handler 支持 query param + JSON body

### 前端修复
2.  — Config 调用方式修正
   - GET /api/v1/widget/config?website_token= → POST /api/v1/widget/config
   - 发送 JSON body: {"website_token":"..."}
   - 后端 Config handler 已同时支持两种调用方式

### 文档更新
3. 修正测试计划 §13.7 已知未实现端点状态
   - 标记 4 项已验证正常(copilot/config、agent_bot_inboxes/、reports/overview)
   - 标记 2 项已修复(widget/config GET+POST)
   - 保留 1 项 P3 未实现(conversation_workflows 需完整 CRUD handler)

### 已验证非 BUG 项
- 仪表盘会话计数的0问题:实际显示 1/13/14 (之前为 stale snapshot)
- 会话列表为空:filter status=open 过滤掉 snoozed 会话 (设计如此)
- Reports API:正确路由 /reports?metric=&since=&until= 
2026-07-28 21:46:53 +08:00
Rogee c3fbb9b908 qa: 第二轮回归测试 — 补充遗漏功能测试用例到测试计划
基于 §6 页面功能矩阵执行第二轮回归,覆盖:

## 新增测试用例(§13)

### 会话操作补充 (14 项)
C1-C14: 客服消息、私密备注、优先级切换/设置、状态流转
(resolve/reopen/snooze)、静音、标签、附件、输入状态、文件上传

### 静态 Auto-Reply (6 项)
AR1-AR6: 规则创建/激活、条件匹配、多规则优先级、AgentBot sender

### LLM Auto-Reply (4 项)
LR1-LR4: Provider 配置、ChatCompletion 可达性、LLM 规则、AI 生成回复

### AgentBot (6 项)
AB1-AB6: CRUD + inbox 绑定

### 前端渲染时序 (4 项)
F1-F4: auth token 同步验证、auto-load 已知 BUG、代理可达性、手动加载

### 已知后端未实现端点 (6 项)
路由缺失 gap 标记:reports、widget/config、conv_workflows 等

### 8 新增断言模板
Sender 身份模板 (D)、AI Provider 连通性模板 (E)

## 已验证核心链路
- Auth token 同步 (BUG-W2) 
- 无 301 重定向 (BUG-W3) 
- Conversation API 12/12 操作 
- Static auto-reply E2E 
- LLM auto-reply (deepseek-v4-flash) 
- AgentBot sender 身份 
- 文件上传 (Metadata jsonb 修复) 
2026-07-28 21:26:24 +08:00
Rogee 9816848ca2 fix: Web Widget SDK + Auto-Reply AgentBot sender + LLM 真实模型对接
## 核心修复

### 1. Auto-Reply Sender 修复(所有渠道)
- AutoReplyListener.sendAutoReply() 通过 botInboxRepo 查询 inbox 关联的 AgentBot
- 使用正确的 SenderType="AgentBot"(非小写 agent_bot)传递真实 AgentBot ID
- bootstrap 注入 agentBotInboxRepo/agentBotRepo 依赖

### 2. 事件数据 BUG 修复(影响所有 Webhook 渠道)
- incoming_persister.dispatch(): 补全 sender_type/content 到 event.Data
- channel/webhook.go: HandleWebhook 同步分发也补全 sender_type/content
- 未补全前 AutoReplyListener 找不到字段直接跳过

### 3. Web Widget SDK 生产验证修复
- cookie → localStorage token 同步(frontend/index.html)
- 路由双注册修复(router.go)
- Vite SPA 模式 + /widget 重写(vite.config.ts)
- WidgetService 注入 Dispatcher 触发事件分发

### 4. LLM 真实模型对接
- 配置 deepseek-v4-flash @ http://10.58.144.6:2014/v1
- LLM-mode auto-reply 规则创建并验证通过
- Prompt 文档落地: docs/captain-ai-auto-replay-prompt.md

### 5. 新增基础设施
- Helm chart (deploy/helm/)
- Widget SDK 生产测试页面
- QA 报告

Closes: BUG-W2 (auth sync), BUG-W3 (route double-reg),
       BUG-WEBHOOK-EVENT (missing event data fields)
2026-07-28 14:03:19 +08:00
Rogee 1c6b8c661c fix: 文件上传Metadata jsonb BUG + search config + fake:ai provider + QA报告
修复:
- message_service.go: 附件Metadata零值字符串''→'{}'(PG jsonb列报错)
- config.dev.yaml/config.development.yaml: search.engine改为db
  (避免依赖未运行的MeiliSearch导致搜索500)

新增:
- fake_provider.go: Captain/AI fake LLM Provider
- test-captain-llm-provider.sh: 测试脚本
- QA测试报告: 93项CDP功能点覆盖验证

文档:
- CDP_TESTING_HANDOFF.md: 进度更新(89%->92%->95%)
- 报告: 11.846~11.897 完整测试日志
2026-07-27 22:01:28 +08:00
rogee 5c604c116e chore: commit all QA artifacts 2026-07-27 15:50:18 +08:00
rogee c3806b701a feat(parity): align Chatwoot 4.15.1 contracts 2026-07-14 12:11:52 +08:00
rogee d16bb55d91 feat(realtime): complete fake channel reply flow 2026-07-13 14:57:28 +08:00
rogee a712b91982 fix(copilot): harden provider configuration flow 2026-07-13 14:57:28 +08:00
rogee 8b9eedc0e2 feat(copilot): finish configuration center 2026-07-13 14:57:28 +08:00
rogee 0a69d80f7c feat(copilot): complete runtime provider configuration 2026-07-13 14:57:28 +08:00
rogee 6b42853c0b update doc 2026-07-13 10:47:58 +08:00
rogee df23caf7d9 feat(copilot): move provider configuration to settings 2026-07-12 22:27:29 +08:00
rogee 32d3329d1b docs(copilot): define global configuration 2026-07-12 22:16:56 +08:00
rogee d2cb6bbbc6 update cdp test round 6 2026-07-10 17:56:36 +08:00
rogee 9c852cd99b add fake channel 2026-07-09 18:14:45 +08:00
rogee 8fed449b95 add plan 2026-07-09 15:43:15 +08:00
rogee 0dabb8cfa5 docs: 整理文档目录结构 — 清理过时文档、归集功能子目录、统一命名规范
清理:
- 删除 34 份过时文档(gap reports/QA临时报告/验收报告/阶段性文档)
- 删除 docs/.hermes/skills 第三方 skills 副本(16 文件)
- 删除 skills-lock.json

目录归集:
- 根目录仅保留 README.md 索引
- product/ — 产品与架构设计(PRD + ARCHITECTURE + P2设计文档 + AI/企业路线图)
- tracking/ — Chatwoot parity 开发跟踪
- requirements/ — M01-M12 模块需求
- plans/ — 历史实现计划
- parity/ — 路由 parity 与前端契约
- qa/ — QA 报告与测试计划
- ops/ — 运维部署

命名规范:
- 全小写 kebab-case,禁止全大写文件名
- product/tracking/ops 用 NN- 序号前缀
- requirements 用 MNN- 两位零填充模块号
- plans/qa 用 YYYY-MM-DD- 日期前缀
- requirements M1-M9 零填充为 M01-M09(修复字典序)

同步更新:
- backend/cmd/route_parity/main.go 路径默认值
- backend/scripts/parity_frontend_smoke.sh 报告路径
- 所有 docs 内部交叉引用
- .gitignore 排除编译产物 (backend/gochat, backend/route_parity)
- 新增迁移 000052/000053
- 前端 WS 相关修改
2026-07-09 14:53:27 +08:00
rogee 805402f938 qa 2026-07-09 13:59:31 +08:00
rogee e8d1876478 Fix sidebar missing Bots/Campaigns: add all feature flags to seed data
The seed data only enabled 16 of 37 feature flags used by the frontend.
Two missing flags caused sidebar navigation bugs found during QA:

- agent_bots: the '机器人' settings link was hidden (isAllowed=false)
- campaigns: the '活动' (Campaigns) parent had no accessible children,
  so clicking it did nothing instead of expanding to show sub-items

Add all 37 feature flags from FEATURE_FLAGS to the smoke seed data so
every sidebar menu item is visible and navigable.

Also includes QA test report for the full-page CDP testing session.
2026-07-08 15:11:11 +08:00
rogee a1ae852eb2 Fix widget i18n missing locale files and clean up unused locales
- widget/i18n/index.js: only import en.json and zh_CN.json (the only
  locale files present); remove 40+ imports for missing locale JSONs
  that caused Vite compile failure and global white screen
- dashboard/i18n/index.js: remove unused locale imports for consistency
- Remove 62 unused locale JSON files from widget/i18n/locale/
- Minor: update index.html, test helpers, e2e test, languages spec
2026-07-08 09:57:00 +08:00
rogee aeddedf2a3 Reorganize repo: backend/, deploy/, docs/ layout + AGENTS.md
Restructure the monorepo into clear top-level directories:
- backend/: Go module root (cmd, internal, pkg, configs, migrations,
  docs/swagger, scripts, tests, go.mod, Makefile, .air.toml)
- deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd
- docs/: project documentation + reports/ (moved from repo root)
- AGENTS.md: new AI coding-agent guide at repo root

Update all references to the new layout:
- Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root)
- docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile,
  env_file ../../.env, volume mounts ../../backend:/app
- deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile
- CI: working-directory: backend for go commands, file deploy/docker/Dockerfile,
  coverage path backend/coverage.out, health_check backend/scripts/
- backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../
- README: architecture tree, quickstart, config paths updated

Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh,
gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to
preserve history. Build, vet, SQLite tests, and docker compose config verified.
2026-07-07 14:44:12 +08:00
rogee d884fdda0a Align GoChat with Chatwoot frontend contracts 2026-06-13 22:13:32 +08:00
rogee 71abf58636 docs: update Chatwoot parity alignment review 2026-06-11 09:57:09 +08:00
rogee 2bb54b21a5 1:1 2026-06-10 07:24:13 +08:00
rogee ac7f351308 update 2026-06-09 18:03:16 +08:00
rogee f45fbfd5f0 feat(captain): secure custom tool auth config 2026-06-07 16:32:13 +08:00