Files
gochat/docs/ROUTE_GAP_ANALYSIS.md
T
2026-06-04 15:44:48 +08:00

1003 lines
34 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# GoChat vs Chatwoot 路由对比分析报告
> 生成日期: 2026-05-24
> 对比源: GoChat `internal/router/router.go` + Chatwoot `config/routes.rb` (v3.x, 717行)
---
## 1. 总览
| 类别 | Chatwoot 路由数 | GoChat 路由数 | 差距 |
|------|----------------|--------------|------|
| Auth (含MFA/SAML/OAuth) | ~15 | 11 | -4 |
| Account | ~8 | 5 | -3 |
| Agent/AgentBots | ~8 | 0 | **完全缺失** |
| Inbox (含渠道特殊操作) | ~15 | 5 | -10 |
| Conversation (含消息/子资源) | ~20 | 9 | -11 |
| Contact (含子资源) | ~15 | 6 | -9 |
| Message | ~6 | 3 | -3 |
| Team | ~8 | 8 | 0 |
| Captain/Copilot | ~25 | 21 | -4 |
| Reporting/Analytics | ~18 | 8 | -10 |
| Dashboard Apps | 5 | 5 | 0 |
| Platform API | ~12 | 5 | -7 |
| Widget API | ~12 | 5 | -7(全是stub) |
| Webhook callbacks | ~10 | 1(stub) | -9 |
| **新增模块(完全缺失)** | 多个 | 0 | **详见§2** |
---
## 2. GoChat完全缺失的API模块/路由
以下模块在Chatwoot routes.rb中有完整路由,但GoChat连路由都没注册:
### 2.1 🔴 Agent/AgentBot 模块(8+路由缺失)
Chatwoot:
```
POST /api/v1/accounts/:id/agents # 创建agent
GET /api/v1/accounts/:id/agents # 列出agents
PATCH /api/v1/accounts/:id/agents/:id # 更新agent
DELETE /api/v1/accounts/:id/agents/:id # 删除agent
POST /api/v1/accounts/:id/agents/bulk_create # 批量创建
GET /api/v1/accounts/:id/agent_bots # agent bot CRUD
POST /api/v1/accounts/:id/agent_bots
GET /api/v1/accounts/:id/agent_bots/:id
PATCH /api/v1/accounts/:id/agent_bots/:id
DELETE /api/v1/accounts/:id/agent_bots/:id
DELETE /api/v1/accounts/:id/agent_bots/:id/avatar # 删除bot头像
POST /api/v1/accounts/:id/agent_bots/:id/reset_access_token
POST /api/v1/accounts/:id/agent_bots/:id/reset_secret
GET /api/v1/accounts/:id/assignable_agents # 可分配agent列表
```
GoChat: **无任何路由**
### 2.2 🔴 Canned Responses(快捷回复)(4路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/canned_responses
POST /api/v1/accounts/:id/canned_responses
PATCH /api/v1/accounts/:id/canned_responses/:id
DELETE /api/v1/accounts/:id/canned_responses/:id
```
GoChat: **无路由**
### 2.3 🔴 Automation Rules(自动化规则)(6路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/automation_rules
POST /api/v1/accounts/:id/automation_rules
GET /api/v1/accounts/:id/automation_rules/:id
PATCH /api/v1/accounts/:id/automation_rules/:id
DELETE /api/v1/accounts/:id/automation_rules/:id
POST /api/v1/accounts/:id/automation_rules/:id/clone
```
GoChat: **无路由**
### 2.4 🔴 Macros(宏操作)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/macros
POST /api/v1/accounts/:id/macros
GET /api/v1/accounts/:id/macros/:id
PATCH /api/v1/accounts/:id/macros/:id
DELETE /api/v1/accounts/:id/macros/:id
POST /api/v1/accounts/:id/macros/:id/execute
```
GoChat: **无路由**
### 2.5 🔴 SLA Policies(服务等级协议)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/sla_policies
POST /api/v1/accounts/:id/sla_policies
GET /api/v1/accounts/:id/sla_policies/:id
PATCH /api/v1/accounts/:id/sla_policies/:id
DELETE /api/v1/accounts/:id/sla_policies/:id
```
GoChat: **无路由**
### 2.6 🔴 Custom Roles(自定义角色)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/custom_roles
POST /api/v1/accounts/:id/custom_roles
GET /api/v1/accounts/:id/custom_roles/:id
PATCH /api/v1/accounts/:id/custom_roles/:id
DELETE /api/v1/accounts/:id/custom_roles/:id
```
GoChat: **无路由**(虽然API_COVERAGE_REPORT.md声称100%,但路由文件中未注册)
### 2.7 🔴 Agent Capacity Policies(agent容量策略)(7+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/agent_capacity_policies
POST /api/v1/accounts/:id/agent_capacity_policies
GET /api/v1/accounts/:id/agent_capacity_policies/:id
PATCH /api/v1/accounts/:id/agent_capacity_policies/:id
DELETE /api/v1/accounts/:id/agent_capacity_policies/:id
GET /api/v1/accounts/:id/agent_capacity_policies/:id/users
POST /api/v1/accounts/:id/agent_capacity_policies/:id/users
DELETE /api/v1/accounts/:id/agent_capacity_policies/:id/users/:id
POST /api/v1/accounts/:id/agent_capacity_policies/:id/inbox_limits
PATCH /api/v1/accounts/:id/agent_capacity_policies/:id/inbox_limits/:id
DELETE /api/v1/accounts/:id/agent_capacity_policies/:id/inbox_limits/:id
```
GoChat: **无路由**
### 2.8 🔴 Assignment Policies(分配策略V2)(5+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/assignment_policies
POST /api/v1/accounts/:id/assignment_policies
GET /api/v1/accounts/:id/assignment_policies/:id
PATCH /api/v1/accounts/:id/assignment_policies/:id
DELETE /api/v1/accounts/:id/assignment_policies/:id
GET /api/v1/accounts/:id/assignment_policies/:id/inboxes
POST /api/v1/accounts/:id/assignment_policies/:id/inboxes
DELETE /api/v1/accounts/:id/assignment_policies/:id/inboxes/:id
GET /api/v1/accounts/:id/inboxes/:id/assignment_policy
POST /api/v1/accounts/:id/inboxes/:id/assignment_policy
DELETE /api/v1/accounts/:id/inboxes/:id/assignment_policy
```
GoChat: **无路由**
### 2.9 🔴 Campaigns(营销活动)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/campaigns
POST /api/v1/accounts/:id/campaigns
GET /api/v1/accounts/:id/campaigns/:id
PATCH /api/v1/accounts/:id/campaigns/:id
DELETE /api/v1/accounts/:id/campaigns/:id
```
GoChat: **无路由**
### 2.10 🔴 Search(全文搜索)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/search
GET /api/v1/accounts/:id/search/conversations
GET /api/v1/accounts/:id/search/messages
GET /api/v1/accounts/:id/search/contacts
GET /api/v1/accounts/:id/search/articles
```
GoChat: **无路由**(Contact.Search只覆盖contact搜索)
### 2.11 🔴 Companies(公司/企业客户)(10+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/companies
POST /api/v1/accounts/:id/companies
GET /api/v1/accounts/:id/companies/:id
PATCH /api/v1/accounts/:id/companies/:id
DELETE /api/v1/accounts/:id/companies/:id
GET /api/v1/accounts/:id/companies/search
POST /api/v1/accounts/:id/companies/:id/destroy_custom_attributes
DELETE /api/v1/accounts/:id/companies/:id/avatar
GET /api/v1/accounts/:id/companies/:id/contacts
GET /api/v1/accounts/:id/companies/:id/contacts/search
POST /api/v1/accounts/:id/companies/:id/contacts
DELETE /api/v1/accounts/:id/companies/:id/contacts/:id
GET /api/v1/accounts/:id/companies/:id/conversations
GET /api/v1/accounts/:id/companies/:id/notes
```
GoChat: **无路由**
### 2.12 🔴 CSAT Survey Responses(满意度调查)(4+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/csat_survey_responses
GET /api/v1/accounts/:id/csat_survey_responses/metrics
GET /api/v1/accounts/:id/csat_survey_responses/download
PATCH /api/v1/accounts/:id/csat_survey_responses/:id (enterprise)
```
GoChat: **无路由**
### 2.13 🔴 Applied SLAs(SLA应用追踪)(3路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/applied_slas
GET /api/v1/accounts/:id/applied_slas/metrics
GET /api/v1/accounts/:id/applied_slas/download
```
GoChat: **无路由**
### 2.14 🔴 Custom Attribute Definitions(自定义属性定义)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/custom_attribute_definitions
POST /api/v1/accounts/:id/custom_attribute_definitions
GET /api/v1/accounts/:id/custom_attribute_definitions/:id
PATCH /api/v1/accounts/:id/custom_attribute_definitions/:id
DELETE /api/v1/accounts/:id/custom_attribute_definitions/:id
```
GoChat: **无路由**
### 2.15 🔴 Custom Filters(自定义过滤器)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/custom_filters
POST /api/v1/accounts/:id/custom_filters
GET /api/v1/accounts/:id/custom_filters/:id
PATCH /api/v1/accounts/:id/custom_filters/:id
DELETE /api/v1/accounts/:id/custom_filters/:id
```
GoChat: **无路由**
### 2.16 🔴 Labels(标签管理)(5路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/labels
POST /api/v1/accounts/:id/labels
GET /api/v1/accounts/:id/labels/:id
PATCH /api/v1/accounts/:id/labels/:id
DELETE /api/v1/accounts/:id/labels/:id
```
GoChat: **无独立路由**(只在conversation下有UpdateLabels)
### 2.17 🔴 Webhooks(用户级webhook管理)(4路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/webhooks
POST /api/v1/accounts/:id/webhooks
PATCH /api/v1/accounts/:id/webhooks/:id
DELETE /api/v1/accounts/:id/webhooks/:id
```
GoChat: **无路由**(只有webhook callback stub)
### 2.18 🔴 Integrations(集成应用)(15+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/integrations/apps
GET /api/v1/accounts/:id/integrations/apps/:id
GET /api/v1/accounts/:id/integrations/hooks/:id
POST /api/v1/accounts/:id/integrations/hooks
PATCH /api/v1/accounts/:id/integrations/hooks/:id
DELETE /api/v1/accounts/:id/integrations/hooks/:id
POST /api/v1/accounts/:id/integrations/hooks/:id/process_event
# Slack集成
POST /api/v1/accounts/:id/integrations/slack
PATCH /api/v1/accounts/:id/integrations/slack
DELETE /api/v1/accounts/:id/integrations/slack
GET /api/v1/accounts/:id/integrations/slack/list_all_channels
# Dyte视频会议集成
POST /api/v1/accounts/:id/integrations/dyte/create_a_meeting
POST /api/v1/accounts/:id/integrations/dyte/add_participant_to_meeting
# Shopify集成
DELETE /api/v1/accounts/:id/integrations/shopify
POST /api/v1/accounts/:id/integrations/shopify/auth
GET /api/v1/accounts/:id/integrations/shopify/orders
# Linear集成
DELETE /api/v1/accounts/:id/integrations/linear
GET /api/v1/accounts/:id/integrations/linear/teams
GET /api/v1/accounts/:id/integrations/linear/team_entities
POST /api/v1/accounts/:id/integrations/linear/create_issue
POST /api/v1/accounts/:id/integrations/linear/link_issue
POST /api/v1/accounts/:id/integrations/linear/unlink_issue
GET /api/v1/accounts/:id/integrations/linear/search_issue
GET /api/v1/accounts/:id/integrations/linear/linked_issues
# Notion集成
DELETE /api/v1/accounts/:id/integrations/notion
```
GoChat: **无路由**
### 2.19 🔴 Help Center / Portals(知识库门户)(20+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/portals
POST /api/v1/accounts/:id/portals
GET /api/v1/accounts/:id/portals/:id
PATCH /api/v1/accounts/:id/portals/:id
DELETE /api/v1/accounts/:id/portals/:id
PATCH /api/v1/accounts/:id/portals/:id/archive
DELETE /api/v1/accounts/:id/portals/:id/logo
POST /api/v1/accounts/:id/portals/:id/send_instructions
GET /api/v1/accounts/:id/portals/:id/ssl_status
GET /api/v1/accounts/:id/portals/:id/categories
POST /api/v1/accounts/:id/portals/:id/categories
GET /api/v1/accounts/:id/portals/:id/categories/:id
PATCH /api/v1/accounts/:id/portals/:id/categories/:id
DELETE /api/v1/accounts/:id/portals/:id/categories/:id
POST /api/v1/accounts/:id/portals/:id/categories/reorder
GET /api/v1/accounts/:id/portals/:id/articles
POST /api/v1/accounts/:id/portals/:id/articles
GET /api/v1/accounts/:id/portals/:id/articles/:id
PATCH /api/v1/accounts/:id/portals/:id/articles/:id
DELETE /api/v1/accounts/:id/portals/:id/articles/:id
POST /api/v1/accounts/:id/portals/:id/articles/reorder
POST /api/v1/accounts/:id/portals/:id/articles/bulk_actions/translate
PATCH /api/v1/accounts/:id/portals/:id/articles/bulk_actions/update_status
DELETE /api/v1/accounts/:id/portals/:id/articles/bulk_actions/delete_articles
```
GoChat: **无路由**
### 2.20 🔴 Bulk Actions(批量操作)(2路由缺失)
Chatwoot:
```
POST /api/v1/accounts/:id/actions/contact_merge # 合并联系人
POST /api/v1/accounts/:id/bulk_actions # 批量操作
```
GoChat: **无路由**
### 2.21 🔴 Channel OAuth 授权路由(6路由缺失)
Chatwoot:
```
POST /api/v1/accounts/:id/twitter/authorization
POST /api/v1/accounts/:id/microsoft/authorization
POST /api/v1/accounts/:id/google/authorization
POST /api/v1/accounts/:id/instagram/authorization
POST /api/v1/accounts/:id/tiktok/authorization
POST /api/v1/accounts/:id/notion/authorization
POST /api/v1/accounts/:id/whatsapp/authorization
```
GoChat: **无路由**
### 2.22 🔴 Inbox Members(收件箱成员管理)(4路由缺失)
Chatwoot:
```
POST /api/v1/accounts/:id/inbox_members
GET /api/v1/accounts/:id/inbox_members/:inbox_id
DELETE /api/v1/accounts/:id/inbox_members (collection)
PATCH /api/v1/accounts/:id/inbox_members (collection)
```
GoChat: **无路由**
### 2.23 🔴 Upload / Direct Upload(文件上传)(2路由缺失)
Chatwoot:
```
POST /api/v1/accounts/:id/upload # account级文件上传
POST /api/v1/widget/direct_uploads # widget级文件上传
```
GoChat: **无路由**
### 2.24 🔴 Notification Subscriptions(推送订阅)(2路由缺失)
Chatwoot:
```
POST /api/v1/notification_subscriptions # 创建推送订阅
DELETE /api/v1/notification_subscriptions # 删除推送订阅
```
GoChat: **无路由**
### 2.25 🔴 Audit Logs(审计日志)(1路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/audit_logs
```
GoChat: **无路由**
### 2.26 🔴 Reporting Events(事件报告,Enterprise)(1+路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/reporting_events (enterprise)
GET /api/v1/accounts/:id/conversations/:id/reporting_events (enterprise)
```
GoChat: **无路由**
### 2.27 🔴 SAML Settings(SAML配置管理,企业版)(4路由缺失)
Chatwoot:
```
GET /api/v1/accounts/:id/saml_settings
POST /api/v1/accounts/:id/saml_settings
PATCH /api/v1/accounts/:id/saml_settings
DELETE /api/v1/accounts/:id/saml_settings
```
GoChat: **无路由**(只有全局SAML认证端点,缺少account级配置管理)
### 2.28 🔴 API V2 Routes(新版API)(大量路由缺失)
Chatwoot有完整的API V2 namespace,包括更完善的报告和指标端点:
```
GET /api/v2/accounts/:id/summary_reports/agent
GET /api/v2/accounts/:id/summary_reports/team
GET /api/v2/accounts/:id/summary_reports/inbox
GET /api/v2/accounts/:id/summary_reports/label
GET /api/v2/accounts/:id/summary_reports/channel
GET /api/v2/accounts/:id/reports/summary
GET /api/v2/accounts/:id/reports/bot_summary
GET /api/v2/accounts/:id/reports/agents
GET /api/v2/accounts/:id/reports/inboxes
GET /api/v2/accounts/:id/reports/labels
GET /api/v2/accounts/:id/reports/teams
GET /api/v2/accounts/:id/reports/conversations
GET /api/v2/accounts/:id/reports/conversations_summary
GET /api/v2/accounts/:id/reports/conversation_traffic
GET /api/v2/accounts/:id/reports/bot_metrics
GET /api/v2/accounts/:id/reports/inbox_label_matrix
GET /api/v2/accounts/:id/reports/first_response_time_distribution
GET /api/v2/accounts/:id/reports/outgoing_messages_count
GET /api/v2/accounts/:id/year_in_review
GET /api/v2/accounts/:id/live_reports/conversation_metrics
GET /api/v2/accounts/:id/live_reports/grouped_conversation_metrics
```
GoChat: **无V2路由**
### 2.29 🔴 Enterprise API(付费版专属路由)(6路由缺失)
Chatwoot:
```
POST /api/v1/enterprise/accounts/:id/checkout
POST /api/v1/enterprise/accounts/:id/subscription
GET /api/v1/enterprise/accounts/:id/limits
POST /api/v1/enterprise/accounts/:id/toggle_deletion
POST /api/v1/enterprise/accounts/:id/topup_checkout
POST /webhooks/stripe
POST /webhooks/firecrawl
```
GoChat: **无路由**(如果定位自托管版可不实现)
### 2.30 🔴 Platform API扩展路由(7路由缺失)
Chatwoot Platform API:
```
GET /platform/api/v1/users
POST /platform/api/v1/users
GET /platform/api/v1/users/:id
PATCH /platform/api/v1/users/:id
DELETE /platform/api/v1/users/:id
GET /platform/api/v1/users/:id/login
POST /platform/api/v1/users/:id/token
GET /platform/api/v1/agent_bots
POST /platform/api/v1/agent_bots
GET /platform/api/v1/agent_bots/:id
PATCH /platform/api/v1/agent_bots/:id
DELETE /platform/api/v1/agent_bots/:id
DELETE /platform/api/v1/agent_bots/:id/avatar
GET /platform/api/v1/accounts
POST /platform/api/v1/accounts
GET /platform/api/v1/accounts/:id
PATCH /platform/api/v1/accounts/:id
DELETE /platform/api/v1/accounts/:id
GET /platform/api/v1/accounts/:id/account_users
POST /platform/api/v1/accounts/:id/account_users
DELETE /platform/api/v1/accounts/:id/account_users (collection)
POST /platform/api/v1/accounts/:id/email_channel_migrations
```
GoChat: **只有PlatformApp CRUD(5路由),缺失Users/AgentBots/AccountUsers/EmailChannelMigrations**
### 2.31 🔴 Public API(联系人暴露API)(10+路由缺失)
Chatwoot:
```
GET /public/api/v1/inboxes
GET /public/api/v1/inboxes/:id/contacts
POST /public/api/v1/inboxes/:id/contacts
GET /public/api/v1/inboxes/:id/contacts/:id
PATCH /public/api/v1/inboxes/:id/contacts/:id
GET /public/api/v1/inboxes/:id/contacts/:id/conversations
POST /public/api/v1/inboxes/:id/contacts/:id/conversations
GET /public/api/v1/inboxes/:id/contacts/:id/conversations/:id
POST /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/toggle_status
POST /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/toggle_typing
POST /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/update_last_seen
GET /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/messages
POST /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/messages
PATCH /public/api/v1/inboxes/:id/contacts/:id/conversations/:id/messages/:id
GET /public/api/v1/csat_survey/:id
PATCH /public/api/v1/csat_survey/:id
```
GoChat: **无Public API namespace**
---
## 3. GoChat有路由但Handler是Stub/Placeholder的
### 3.1 Account Handler(3个stub)
| 路由 | 状态 |
|------|------|
| GET /accounts/:id | ⚠️ placeholder响应 |
| POST /accounts | ⚠️ placeholder响应 |
| GET /accounts/ | ⚠️ placeholder响应 |
### 3.2 Contact Handler(5个stub)
| 路由 | 状态 |
|------|------|
| GET /contacts/:contact_id | ⚠️ placeholder |
| POST /contacts | ⚠️ placeholder |
| GET /contacts/search | ⚠️ 501 Not Implemented |
| PUT /contacts/:contact_id | ⚠️ 501 Not Implemented |
| DELETE /contacts/:contact_id | ⚠️ 501 Not Implemented |
### 3.3 Conversation Handler(6个stub)
| 路由 | 状态 |
|------|------|
| GET /conversations/:id | ⚠️ placeholder |
| POST /conversations | ⚠️ placeholder |
| PATCH /conversations/:id | ⚠️ 501 Not Implemented |
| POST /conversations/:id/assign | ⚠️ 501 Not Implemented |
| POST /conversations/:id/toggle_status | ⚠️ 501 Not Implemented |
| PATCH /conversations/:id/labels | ⚠️ 501 Not Implemented |
| GET /conversations/:conversation_id/messages | ⚠️ placeholder |
### 3.4 Inbox Handler(4个stub)
| 路由 | 状态 |
|------|------|
| GET /inboxes/:inbox_id | ⚠️ placeholder |
| POST /inboxes | ⚠️ placeholder |
| PUT /inboxes/:inbox_id | ⚠️ 501 Not Implemented |
| DELETE /inboxes/:inbox_id | ⚠️ 501 Not Implemented |
### 3.5 Message Handler(2个stub)
| 路由 | 状态 |
|------|------|
| POST /messages | ⚠️ placeholder |
| GET /messages/:id | ⚠️ 501 Not Implemented |
### 3.6 Platform Handler(1个stub)
| 路由 | 状态 |
|------|------|
| DELETE /platform/api/v1/apps/:id | ⚠️ stub |
### 3.7 Profile Handler(1个stub)
| 路由 | 状态 |
|------|------|
| GET /profile | ⚠️ placeholder("Should fetch from user_repo, but placeholder until integrated") |
### 3.8 Widget API(全部5个stub)
| 路由 | 状态 |
|------|------|
| POST /widget/init | ⚠️ placeholder (P9) |
| POST /widget/contact | ⚠️ placeholder (P9) |
| GET /widget/conversations | ⚠️ placeholder (P9) |
| POST /widget/messages | ⚠️ placeholder (P9) |
| GET /widget/cable_token | ⚠️ placeholder (P9) |
### 3.9 Webhook Callback(1个stub覆盖所有)
| 路由 | 状态 |
|------|------|
| /webhooks/:channel_type/:identifier (Any method) | ⚠️ placeholder (P7) |
---
## 4. Chatwoot有路由但GoChat已简化合并的(设计性差距)
这些不是"缺失",而是GoChat有意简化合并的设计决策:
### 4.1 Conversation子操作合并
Chatwoot把对话操作拆成多个独立POST动作,GoChat合并为PATCH更新:
```
Chatwoot:
POST /conversations/:id/mute → GoChat: PATCH /conversations/:id (body: {muted: true})
POST /conversations/:id/unmute → 同上
POST /conversations/:id/transcript → GoChat: 缺失(需邮件发送对话记录)
POST /conversations/:id/toggle_priority → GoChat: 缺失
POST /conversations/:id/toggle_typing_status → GoChat: 缺失
POST /conversations/:id/update_last_seen → GoChat: 缺失
POST /conversations/:id/unread → GoChat: 缺失
POST /conversations/:id/custom_attributes → GoChat: 缺失
GET /conversations/:id/attachments → GoChat: 缺失
```
### 4.2 Contact子资源缺失
```
Chatwoot:
GET /contacts/:id/contactable_inboxes → GoChat: 缺失
POST /contacts/:id/destroy_custom_attributes → GoChat: 缺失
DELETE /contacts/:id/avatar → GoChat: 缺失
GET /contacts/active → GoChat: 缺失(只有list和search)
POST /contacts/filter → GoChat: 缺失
POST /contacts/import → GoChat: 缺失
POST /contacts/export → GoChat: 缺失
GET /contacts/:id/conversations → GoChat: 缺失
POST /contacts/:id/contact_inboxes → GoChat: 缺失
GET /contacts/:id/labels → GoChat: 缺失
GET /contacts/:id/notes → GoChat: 缺失
GET /contacts/:id/attachments → GoChat: 缺失
```
### 4.3 Inbox扩展操作缺失
```
Chatwoot:
GET /inboxes/:id/assignable_agents → GoChat: 缺失
GET /inboxes/:id/campaigns → GoChat: 缺失
GET /inboxes/:id/agent_bot → GoChat: 缺失
POST /inboxes/:id/set_agent_bot → GoChat: 缺失
DELETE /inboxes/:id/avatar → GoChat: 缺失
POST /inboxes/:id/sync_templates → GoChat: 缺失
GET /inboxes/:id/health → GoChat: 缺失
POST /inboxes/:id/register_webhook → GoChat: 缺失
POST /inboxes/:id/reset_secret → GoChat: 缺失
```
### 4.4 Message扩展操作缺失
```
Chatwoot:
DELETE /messages/:id → GoChat: 缺失
PATCH /messages/:id → GoChat: 缺失(消息更新/编辑)
POST /messages/:id/translate → GoChat: 缺失
POST /messages/:id/retry → GoChat: 缺失
```
### 4.5 Profile扩展操作缺失
```
Chatwoot:
POST /profile/availability → GoChat: 有(UpdateAvailability)
POST /profile/auto_offline → GoChat: 缺失
PUT /profile/set_active_account → GoChat: 缺失
POST /profile/resend_confirmation → GoChat: 缺失
POST /profile/reset_access_token → GoChat: 缺失
```
### 4.6 Captain模块差异
```
Chatwoot有但GoChat缺失的Captain路由:
POST /captain/assistants/:id/playground → GoChat: 缺失
GET /captain/assistants/tools → GoChat: 缺失(assistant可用工具列表)
GET /captain/assistant_responses → GoChat: 缺失
POST /captain/bulk_actions → GoChat: 缺失
POST /captain/custom_tools/test → GoChat: 缺失
POST /captain/documents/:id/sync → GoChat: 缺失
Chatwoot Copilot任务路由(GoChat部分缺失):
POST /captain/tasks/rewrite → GoChat: 缺失(但有suggest_replies/summarize/translate)
POST /captain/tasks/label_suggestion → GoChat: 缺失
POST /captain/tasks/follow_up → GoChat: 缺失
```
### 4.7 Notification扩展缺失
```
Chatwoot:
POST /notifications/:id/snooze → GoChat: 缺失
POST /notifications/:id/unread → GoChat: 缺失
POST /notifications/destroy_all → GoChat: 缺失(批量删除)
```
---
## 5. 优先级建议(按影响程度排序)
### P0 — 核心业务功能缺失(必须实现)
1. **Conversation扩展操作** — mute/unmute/transcript/toggle_priority/toggle_typing/update_last_seen/unread/attachments/custom_attributes 是对话管理核心
2. **Message CRUD完善** — 更新/删除/翻译/重试是消息操作基础
3. **Contact子资源** — contactable_inboxes/conversations/notes/labels/import/export 是CRM核心
4. **Inbox扩展操作** — assignable_agents/agent_bot/sync_templates/health 是收件箱管理基础
5. **Agent/AgentBot模块** — agent分配是客服系统核心功能
6. **Assignable Agents** — 获取可分配agent列表是分配功能的前置
### P1 — 重要业务功能缺失(应优先实现)
7. **Canned Responses** — 快捷回复是客服效率关键
8. **Automation Rules** — 自动化规则是运营效率核心
9. **Labels独立管理** — 标签CRUD是分类管理基础
10. **Search全文搜索** — 跨模块搜索是效率关键
11. **CSAT Survey** — 满意度度量是客服质量核心
12. **Webhooks用户管理** — webhook CRUD是集成基础
13. **Inbox Members** — 收件箱成员管理是团队协作基础
14. **Contact active/filter** — 活跃联系人和高级过滤是列表管理关键
### P2 — 增值功能缺失(可后续实现)
15. **Macros** — 宏操作是高级效率工具
16. **SLA Policies** — SLA是企业版核心
17. **Custom Roles** — 自定义角色是权限管理关键
18. **Agent Capacity Policies** — 容量策略是负载管理
19. **Assignment Policies V2** — 分配策略是高级路由
20. **Campaigns** — 营销活动是增值功能
21. **Companies** — 公司/企业客户是B2B功能
22. **Custom Attributes** — 自定义属性是扩展能力
23. **Custom Filters** — 自定义过滤器是UI过滤
24. **Audit Logs** — 审计日志是企业合规
25. **Upload** — 文件上传是基础功能
### P3 — 长期功能(可规划实现)
26. **Help Center/Portals** — 知识库是大型功能
27. **Integrations全套** — Slack/Dyte/Shopify/Linear/Notion等
28. **Channel OAuth** — Twitter/Microsoft/Google/Instagram/TikTok/Notion/WhatsApp授权
29. **API V2** — 新版API
30. **Public API** — 外部暴露API
31. **Platform API扩展** — Users/AgentBots/AccountUsers
32. **Enterprise API** — 付费版特有
33. **Reporting Events** — 企业版事件报告
---
## 6. Stub Handler完善优先级
需要从placeholder/stub升级为真正实现的handler(按业务优先级排序):
| Handler | Stub数 | 优先级 |
|---------|--------|--------|
| Conversation | 6 | P0 |
| Contact | 5 | P0 |
| Inbox | 4 | P0 |
| Message | 2 | P0 |
| Account | 3 | P1 |
| Widget (全部) | 5 | P1 |
| Profile | 1 | P2 |
| Platform | 1 | P3 |
---
## 7. 完整GoChat路由清单(106个)
### Auth Routes (11)
```
POST /api/v1/auth/login
POST /api/v1/auth/login/mfa
POST /api/v1/auth/register
POST /api/v1/auth/refresh
DELETE /api/v1/auth/logout
POST /api/v1/auth/switch_account
POST /api/v1/auth/reset_password
GET /api/v1/auth/confirm_email
GET /api/v1/auth/oauth/authorize
POST /api/v1/auth/oauth/callback
```
### MFA Routes (4)
```
POST /api/v1/auth/mfa/enable
POST /api/v1/auth/mfa/verify
POST /api/v1/auth/mfa/disable
GET /api/v1/auth/mfa/status
```
### SAML Routes (3)
```
GET /api/v1/saml/metadata
GET /api/v1/saml/login
POST /api/v1/saml/acs
```
### Profile Routes (5)
```
GET /api/v1/profile
PUT /api/v1/profile
PUT /api/v1/profile/avatar
DELETE /api/v1/profile/avatar (注: 路由文件中无此路由, handler中有DeleteAvatar)
POST /api/v1/profile/availability (注: 路由文件中无此路由, handler中有UpdateAvailability)
```
⚠️ **路由文件缺少 DELETE /profile/avatar 和 POST /profile/availability 路由注册**
### Notification Routes (11)
```
GET /api/v1/notifications
GET /api/v1/notifications/unread_count
POST /api/v1/notifications/read_all
POST /api/v1/notifications/:id/read
PUT /api/v1/notifications/:id
DELETE /api/v1/notifications/:id
GET /api/v1/accounts/:id/notification_settings
PUT /api/v1/accounts/:id/notification_settings
```
### Account Routes (7)
```
GET /api/v1/accounts/
POST /api/v1/accounts/
GET /api/v1/accounts/:id
PUT /api/v1/accounts/:id
DELETE /api/v1/accounts/:id
GET /api/v1/accounts/:id/platform_apps
POST /api/v1/accounts/:id/platform_apps
```
### Inbox Routes (9)
```
GET /api/v1/accounts/:id/inboxes/
POST /api/v1/accounts/:id/inboxes/
GET /api/v1/accounts/:id/inboxes/:inbox_id
PUT /api/v1/accounts/:id/inboxes/:inbox_id
DELETE /api/v1/accounts/:id/inboxes/:inbox_id
POST /api/v1/accounts/:id/inboxes/web_widget
GET /api/v1/accounts/:id/inboxes/:inbox_id/web_widget_config
PUT /api/v1/accounts/:id/inboxes/:inbox_id/web_widget_config
DELETE /api/v1/accounts/:id/inboxes/:inbox_id/web_widget
```
### Conversation Routes (9)
```
GET /api/v1/accounts/:id/conversations/
POST /api/v1/accounts/:id/conversations/
GET /api/v1/accounts/:id/conversations/:id
PATCH /api/v1/accounts/:id/conversations/:id
POST /api/v1/accounts/:id/conversations/:id/assign
POST /api/v1/accounts/:id/conversations/:id/toggle_status
PATCH /api/v1/accounts/:id/conversations/:id/labels
GET /api/v1/accounts/:id/conversations/:conversation_id/messages
POST /api/v1/accounts/:id/conversations/:conversation_id/messages
```
### Contact Routes (6)
```
GET /api/v1/accounts/:id/contacts/
POST /api/v1/accounts/:id/contacts/
GET /api/v1/accounts/:id/contacts/search
GET /api/v1/accounts/:id/contacts/:contact_id
PUT /api/v1/accounts/:id/contacts/:contact_id
DELETE /api/v1/accounts/:id/contacts/:contact_id
```
### Message Routes (1)
```
GET /api/v1/accounts/:id/conversations/:conversation_id/messages/:id
```
### Team Routes (8)
```
GET /api/v1/accounts/:id/teams/
POST /api/v1/accounts/:id/teams/
GET /api/v1/accounts/:id/teams/:id
PUT /api/v1/accounts/:id/teams/:id
DELETE /api/v1/accounts/:id/teams/:id
POST /api/v1/accounts/:id/teams/:id/members
DELETE /api/v1/accounts/:id/teams/:id/members/:user_id
GET /api/v1/accounts/:id/teams/:id/members
```
### Captain Routes (21)
```
# Assistants (6)
GET /api/v1/accounts/:id/captain/assistants/
POST /api/v1/accounts/:id/captain/assistants/
GET /api/v1/accounts/:id/captain/assistants/:id
PUT /api/v1/accounts/:id/captain/assistants/:id
DELETE /api/v1/accounts/:id/captain/assistants/:id
POST /api/v1/accounts/:id/captain/assistants/:id/inboxes
DELETE /api/v1/accounts/:id/captain/assistants/:id/inboxes/:inbox_id
# Documents (4)
GET /api/v1/accounts/:id/captain/assistants/:assistant_id/documents/
POST /api/v1/accounts/:id/captain/assistants/:assistant_id/documents/
GET /api/v1/accounts/:id/captain/assistants/:assistant_id/documents/:id
DELETE /api/v1/accounts/:id/captain/assistants/:assistant_id/documents/:id
# Scenarios (5)
GET /api/v1/accounts/:id/captain/assistants/:assistant_id/scenarios/
POST /api/v1/accounts/:id/captain/assistants/:assistant_id/scenarios/
GET /api/v1/accounts/:id/captain/assistants/:assistant_id/scenarios/:id
PUT /api/v1/accounts/:id/captain/assistants/:assistant_id/scenarios/:id
DELETE /api/v1/accounts/:id/captain/assistants/:assistant_id/scenarios/:id
# Custom Tools (5)
GET /api/v1/accounts/:id/captain/custom_tools/
POST /api/v1/accounts/:id/captain/custom_tools/
GET /api/v1/accounts/:id/captain/custom_tools/:id
PUT /api/v1/accounts/:id/captain/custom_tools/:id
DELETE /api/v1/accounts/:id/captain/custom_tools/:id
# Copilot Threads (5)
GET /api/v1/accounts/:id/captain/copilot_threads/
POST /api/v1/accounts/:id/captain/copilot_threads/
GET /api/v1/accounts/:id/captain/copilot_threads/:id
DELETE /api/v1/accounts/:id/captain/copilot_threads/:id
POST /api/v1/accounts/:id/captain/copilot_threads/:id/messages
# Copilot Actions (3)
POST /api/v1/accounts/:id/captain/copilot/suggest_replies
POST /api/v1/accounts/:id/captain/copilot/summarize
POST /api/v1/accounts/:id/captain/copilot/translate
```
### Analytics/Reports Routes (8)
```
GET /api/v1/accounts/:id/reports/summary
GET /api/v1/accounts/:id/reports/agents
GET /api/v1/accounts/:id/reports/inboxes
GET /api/v1/accounts/:id/reports/labels
GET /api/v1/accounts/:id/reports/teams
GET /api/v1/accounts/:id/reports/conversations
GET /api/v1/accounts/:id/reports/conversation_traffic
GET /api/v1/accounts/:id/live_reports/conversation_metrics
```
### Dashboard Apps Routes (5)
```
GET /api/v1/accounts/:id/dashboard_apps/
POST /api/v1/accounts/:id/dashboard_apps/
GET /api/v1/accounts/:id/dashboard_apps/:id
PUT /api/v1/accounts/:id/dashboard_apps/:id
DELETE /api/v1/accounts/:id/dashboard_apps/:id
```
### Platform Routes (5)
```
GET /platform/api/v1/apps
POST /platform/api/v1/apps
GET /platform/api/v1/apps/:id
PUT /platform/api/v1/apps/:id
DELETE /platform/api/v1/apps/:id
```
### Widget Routes (5, 全stub)
```
POST /widget/init
POST /widget/contact
GET /widget/conversations
POST /widget/messages
GET /widget/cable_token
```
### Webhook Route (1, stub)
```
ANY /webhooks/:channel_type/:identifier
```
### Health & WebSocket (3)
```
GET /health
GET /ws
GET /cable
```
**总计: ~106个路由注册**
---
## 8. 关键发现摘要
1. **GoChat有106个路由注册,Chatwoot有327+路由** — 覆盖率约32%(按原始路由数计),但考虑到GoChat的简化合并设计,功能覆盖率约为45-50%
2. **15个完整模块完全缺失** — Agent/AgentBot, Canned Responses, Automation Rules, Macros, SLA, Custom Roles, Agent Capacity, Assignment Policies, Campaigns, Search, Companies, CSAT, Custom Attributes, Custom Filters, Labels独立管理, Integrations, Help Center/Portals, Bulk Actions, Channel OAuth, Inbox Members, Upload, Notification Subscriptions, Audit Logs, Public API, SAML Settings
3. **已有路由中25+个handler是stub/placeholder** — 核心业务模块(Conversation/Contact/Inbox/Message)的handler大部分是501 Not Implemented
4. **Widget和Webhook完全未实现** — 5个widget路由和1个webhook路由全部是placeholder
5. **路由文件与handler代码不一致** — Profile handler有DeleteAvatar和UpdateAvailability方法,但router.go中未注册对应路由
6. **API V2完全缺失** — Chatwoot有完整的V2报告API,GoChat没有任何V2端点
7. **Platform API严重不足** — 只有PlatformApp CRUD,缺失Users/AgentBots/AccountUsers等关键平台端点
---
*本报告基于 GoChat commit (当前HEAD) 与 Chatwoot develop分支 routes.rb 的逐行对比分析*