44e77dcb0e
**重构前**(旧编号 02-11): - docs/02-产品需求/ → 00 产品规划/PRD - docs/03-技术架构/ → 01-05 子目录散落 - docs/04-原型设计/ → 01-02 产品设计(HTML 原型) - docs/05-原型设计/ → screens/ - docs/06-测试素材/ → 02-E2E / 03-功能 / 04-版本测试 - docs/07-项目管理/ → 任务说明书/日报/计划 - docs/08-安全审计/ → 审计报告 - docs/09-堡垒运维/ → toolbox / deploy - docs/10-项目管理/ → 任务说明书(重复) - docs/11-历史归档/ → deploy-nas-archived **重构后**(新编号 00-07,语义化): - docs/00-产品开发流程与文档管理规范.md - docs/00-版本迭代总览.md - docs/01-产品文档/ (PRD/原型/认证/会话/AI 服务/坐席/集成) - docs/02-技术文档/ (技术方案/架构图/重构记录/前端改造/实现配置) - docs/03-测试文档/ (E2E/功能用例/版本报告/缺陷单) - docs/04-运维文档/ (部署运维/运维指南) - docs/05-运营文档/ (品牌推广/用户手册) - docs/06-安全审计/ (审计报告) - docs/07-项目管理/ (任务说明书/日报/计划/看板) **净收益**: - 目录编号与产品文档管理规范对齐(按文档阶段 01-07 编号) - 消除 02-产品需求 与 10-项目管理 的编号重叠 - 子目录按文档类型分组(如 01-产品文档/00-产品规划、01-产品文档/01-认证与登录) - 把运维/安全/项目管理从 0X 散落改为 04/06/07 合计 494 文件 + 78495 行 / - 14076 行
172 lines
5.1 KiB
Plaintext
172 lines
5.1 KiB
Plaintext
classDiagram
|
|
direction TB
|
|
|
|
%% ===================== 后端 =====================
|
|
|
|
class SessionQueryService {
|
|
+AsyncSession db
|
|
+__init__(db: AsyncSession)
|
|
+get_conversations(status, agent_id, page, page_size) Tuple~List~Conversation~, int~
|
|
+get_agent_conversations(agent_id, page, page_size) Tuple~List~Conversation~, int~
|
|
+get_conversation(conversation_id, include_messages) Conversation
|
|
+get_employee_history_messages(employee_id, limit, before, current_conversation_id) Tuple~List~Message~, bool, Dict~str,str~~
|
|
}
|
|
|
|
class Message {
|
|
+str id
|
|
+str conversation_id
|
|
+str sender_type
|
|
+str sender_id
|
|
+str sender_name
|
|
+str content
|
|
+str msg_type
|
|
+Optional~str~ reply_to_id
|
|
+Optional~str~ media_url
|
|
+Optional~str~ file_name
|
|
+Optional~int~ file_size
|
|
+Optional~Dict~ extra_data
|
|
+bool ai_suggestion
|
|
+str status
|
|
+bool is_read
|
|
+datetime created_at
|
|
}
|
|
|
|
class Conversation {
|
|
+str id
|
|
+str employee_id
|
|
+str employee_name
|
|
+str status
|
|
+str assigned_agent_id
|
|
+datetime last_message_at
|
|
+str last_message_summary
|
|
+datetime created_at
|
|
}
|
|
|
|
class HistoryMessageListResponse {
|
|
+List~MessageResponse~ items
|
|
+bool has_more
|
|
+Dict~str,str~ conversation_summaries
|
|
}
|
|
|
|
class MessageResponse {
|
|
+str id
|
|
+str conversation_id
|
|
+str sender_type
|
|
+str sender_id
|
|
+str sender_name
|
|
+str content
|
|
+str msg_type
|
|
+bool ai_suggestion
|
|
+bool is_read
|
|
+datetime created_at
|
|
+Optional~str~ sender_avatar
|
|
}
|
|
|
|
%% 后端关系
|
|
SessionQueryService ..> Message : 查询
|
|
SessionQueryService ..> Conversation : 查询
|
|
HistoryMessageListResponse *-- MessageResponse : contains
|
|
Message }--|| Conversation : belongs to
|
|
|
|
%% ===================== 前端 API 层 =====================
|
|
|
|
class MessageAPI {
|
|
<<module: frontend-agent/src/api/message.ts>>
|
|
+getMessages(conversationId, params) Promise~MessageListData~
|
|
+sendMessage(conversationId, content, msgType, options) Promise~Message~
|
|
+pollMessages(conversationId, afterMessageId) Promise~MessageListData~
|
|
+getHistoryMessages(employeeId, params) Promise~HistoryMessageListData~
|
|
}
|
|
|
|
class HistoryMessageListData {
|
|
<<TypeScript interface>>
|
|
+Message[] items
|
|
+bool has_more
|
|
+Record~str,str~ conversation_summaries
|
|
}
|
|
|
|
MessageAPI ..> HistoryMessageListData : returns
|
|
MessageAPI ..> BackendAPI : HTTP GET
|
|
|
|
%% ===================== 前端 Store 层 =====================
|
|
|
|
class ConversationStore {
|
|
<<Pinia Store>>
|
|
%% 现有状态
|
|
+Ref~Conversation[]~ conversations
|
|
+Ref~str~ currentConversationId
|
|
+Ref~Message[]~ messages
|
|
+Ref~bool~ loadingMessages
|
|
|
|
%% 新增:历史模式状态
|
|
+Ref~bool~ historyMode
|
|
+Ref~Message[]~ historyMessages
|
|
+Ref~bool~ historyLoading
|
|
+Ref~bool~ historyHasMore
|
|
+Ref~Record~str,str~~ historyConversationSummaries
|
|
+Ref~str~ historyCursor
|
|
|
|
%% 新增:计算属性
|
|
+Computed~Message[]~ displayMessages
|
|
+Computed~bool~ isHistoryReadonly
|
|
|
|
%% 现有方法
|
|
+fetchConversations() void
|
|
+selectConversation(conversationId) void
|
|
+fetchMessages(conversationId) void
|
|
+sendReply(content, replyToId) void
|
|
|
|
%% 新增:历史模式方法
|
|
+enableHistoryMode() Promise~void~
|
|
+disableHistoryMode() void
|
|
+loadMoreHistory() Promise~void~
|
|
+resetHistoryState() void
|
|
}
|
|
|
|
ConversationStore ..> MessageAPI : calls
|
|
ConversationStore ..> Message : manages
|
|
|
|
%% ===================== 前端组件层 =====================
|
|
|
|
class UserInfoBar {
|
|
<<Vue Component>>
|
|
+Props: conversation, availableAgents, canInviteCollaborator
|
|
+Emits: assign, resolve, toggle-pin, toggle-todo, transfer, invite
|
|
+Emits: toggle-history %% 新增
|
|
+resetForNewConversation() void
|
|
%% 新增:历史开关三态
|
|
+historyToggleClass: Computed~string~
|
|
}
|
|
|
|
class ChatArea {
|
|
<<Vue Component>>
|
|
+conversationStore: ConversationStore
|
|
+messageListRef: Ref~HTMLElement~
|
|
%% 新增:渲染逻辑
|
|
+renderedItems: Computed~Array~
|
|
+handleToggleHistory() void
|
|
+handleScrollUp() void
|
|
%% 修改:displayMessages 替代 messages
|
|
}
|
|
|
|
class ConversationSeparator {
|
|
<<Vue Component — 新增>>
|
|
+Props: summary: string
|
|
+Props: isCurrent: boolean
|
|
%% 纯展示组件,无 emit
|
|
}
|
|
|
|
class MessageBubble {
|
|
<<Vue Component — 已存在>>
|
|
+Props: message: Message
|
|
+Emits: reply, scroll-to-message
|
|
}
|
|
|
|
%% 组件关系
|
|
ChatArea ..> ConversationStore : uses
|
|
ChatArea ..> UserInfoBar : contains
|
|
ChatArea ..> ConversationSeparator : renders
|
|
ChatArea ..> MessageBubble : renders
|
|
UserInfoBar --|> ChatArea : child component
|
|
ConversationSeparator --|> ChatArea : child component
|