refactor: 将客服后端重构为宿主可嵌入模块

- 注入数据库、运行时配置、统一响应、文件存储和平台 AI 能力,补充业务读写工具与客户快捷操作契约。

- 移除模块内重复的组织、客户、工单、标签、技能、旧工作流、MCP 和迁移实现,将身份权限与业务主体交由宿主管理。

- 使用 libSQL 重构向量存储,并完善图片消息、访客身份、排队调度、企业微信和支持聊天页面。

- 统一 HTTP、DTO 与 WebSocket 的 snake_case 协议,补齐模块初始化、业务动作和公共载荷等回归测试。
This commit is contained in:
t
2026-08-28 22:23:13 +08:00
parent 6845c728f8
commit 18c9354095
377 changed files with 13199 additions and 22881 deletions
@@ -2,49 +2,55 @@ package response
import "code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
type ConversationTagResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
type ConversationParticipantResponse struct {
ID int64 `json:"id"`
ParticipantType string `json:"participantType"`
ParticipantID int64 `json:"participantId"`
ExternalParticipantID string `json:"externalParticipantId,omitempty"`
JoinedAt string `json:"joinedAt,omitempty"`
LeftAt string `json:"leftAt,omitempty"`
ParticipantType string `json:"participant_type"`
ParticipantID int64 `json:"participant_id"`
ExternalParticipantID string `json:"external_participant_id,omitempty"`
JoinedAt string `json:"joined_at,omitempty"`
LeftAt string `json:"left_at,omitempty"`
Status enums.Status `json:"status"`
}
type ConversationResponse struct {
ID int64 `json:"id"`
AIAgentID int64 `json:"aiAgentId"`
ChannelID int64 `json:"channelId"`
CustomerID int64 `json:"customerId"`
CustomerName string `json:"customerName"`
AIAgentID int64 `json:"ai_agent_id"`
ChannelID int64 `json:"channel_id"`
CustomerType string `json:"customer_type"`
CustomerID int64 `json:"customer_id"`
CustomerExternalID string `json:"customer_external_id"`
CustomerName string `json:"customer_name"`
Status enums.IMConversationStatus `json:"status"`
ServiceMode enums.IMConversationServiceMode `json:"serviceMode"`
ServiceMode enums.IMConversationServiceMode `json:"service_mode"`
Priority int `json:"priority"`
CurrentAssigneeID int64 `json:"currentAssigneeId"`
CurrentAssigneeName string `json:"currentAssigneeName,omitempty"`
CurrentTeamID int64 `json:"currentTeamId"`
CurrentTeamName string `json:"currentTeamName,omitempty"`
LastMessageID int64 `json:"lastMessageId"`
LastMessageAt string `json:"lastMessageAt,omitempty"`
LastActiveAt string `json:"lastActiveAt,omitempty"`
LastMessageSummary string `json:"lastMessageSummary,omitempty"`
CustomerUnreadCount int `json:"customerUnreadCount"`
AgentUnreadCount int `json:"agentUnreadCount"`
CustomerLastReadMessageID int64 `json:"customerLastReadMessageId"`
CustomerLastReadAt string `json:"customerLastReadAt,omitempty"`
AgentLastReadMessageID int64 `json:"agentLastReadMessageId"`
AgentLastReadAt string `json:"agentLastReadAt,omitempty"`
CustomerOnline bool `json:"customerOnline"`
ClosedAt string `json:"closedAt,omitempty"`
ClosedBy int64 `json:"closedBy"`
ClosedByName string `json:"closedByName,omitempty"`
CloseReason string `json:"closeReason,omitempty"`
CurrentAssigneeID int64 `json:"current_assignee_id"`
CurrentAssigneeName string `json:"current_assignee_name,omitempty"`
CurrentTeamID int64 `json:"current_team_id"`
CurrentTeamName string `json:"current_team_name,omitempty"`
LastMessageID int64 `json:"last_message_id"`
LastMessageAt string `json:"last_message_at,omitempty"`
LastActiveAt string `json:"last_active_at,omitempty"`
LastMessageSummary string `json:"last_message_summary,omitempty"`
CustomerUnreadCount int `json:"customer_unread_count"`
AgentUnreadCount int `json:"agent_unread_count"`
CustomerLastReadMessageID int64 `json:"customer_last_read_message_id"`
CustomerLastReadAt string `json:"customer_last_read_at,omitempty"`
AgentLastReadMessageID int64 `json:"agent_last_read_message_id"`
AgentLastReadAt string `json:"agent_last_read_at,omitempty"`
CustomerOnline bool `json:"customer_online"`
QueueEnteredAt string `json:"queue_entered_at,omitempty"`
QueuePosition int `json:"queue_position"`
QueueAheadCount int `json:"queue_ahead_count"`
QueueWaitingCount int `json:"queue_waiting_count"`
QueueWaitSeconds int64 `json:"queue_wait_seconds"`
QueueEstimatedWaitSeconds int64 `json:"queue_estimated_wait_seconds"`
QueueEscalationLevel int `json:"queue_escalation_level"`
EffectivePriority int `json:"effective_priority"`
QueueServiceOnline bool `json:"queue_service_online"`
ClosedAt string `json:"closed_at,omitempty"`
ClosedBy int64 `json:"closed_by"`
ClosedByName string `json:"closed_by_name,omitempty"`
CloseReason string `json:"close_reason,omitempty"`
}
type ConversationDetailResponse struct {