chore: docs 结构整改 + compose 双目录对齐(合并重建提交)
本提交为 .git 对象库损坏后的重建提交,内容等价于原先三个本地提交 (5e2fd4c2 / 57a53c98 / 5d7e1873)的累积结果,未做任何额外改动。 一、docs 结构整改(整改 #14) 根因:重构时新结构为 untracked 文件,执行 git stash(未带 -u)未纳入, 随后 git reset 拉回 HEAD 旧 tracked 树,导致旧树复活、新旧两棵目录 树并存于 docs/,共 791 文件、双分类体系冲突。 修复动作: - b2 同名异主题文件改名迁移保全 9 个 - C 类 39 个孤立文件按主题正确归类 - A/B1 类 222 个重复文件删除(新结构已有内容副本) - 9 个旧独有空目录删除 - 270 处内部引用按 verified 映射改写 - 整改记录 #14 登记于 04-运维文档/部署运维 结果:docs 791 → 569 文件,顶层仅规范 8 类 + 治理文件,单树恢复。 残留:约 20 处指向从未存在文件的陈旧死链,归入独立文档卫生任务。 二、compose 双目录对齐(消除踩坑 A) - docker-compose.yml:nginx 前端挂载全部由根目录 frontend-*/dist 改为 src/frontend-*/dist(h5 / agent / admin / terminal) - docker-compose.dev.yml:dev 服务 build context 与卷同步改 src/ - 效果:本地 docker compose up 不再把根目录 stale dist 挂回, 与线上一致,分叉隐患消除(已 docker compose config 校验通过) 防复发铁律: - 重构须提交;仓库修复须 git stash -u 或先 commit - 新结构须 git add 并提交,避免再次 untracked 复活 - H5 改动只动 src/frontend-h5/,禁改根目录遗留 frontend-*/
This commit is contained in:
@@ -0,0 +1,271 @@
|
||||
# 复杂场景重构第一阶段 — 类图
|
||||
|
||||
> **关联文档**: `复杂场景重构第一阶段-架构设计.md` §3
|
||||
|
||||
---
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
direction TB
|
||||
|
||||
%% ==================== 数据模型层 ====================
|
||||
namespace Models {
|
||||
class AutoSession {
|
||||
+String id
|
||||
+String conversation_id
|
||||
+String employee_id
|
||||
+String agent_id
|
||||
+String scenario_key
|
||||
+String status
|
||||
+String mode
|
||||
+Float confidence
|
||||
+JSON intent
|
||||
+String current_action_id
|
||||
+String title
|
||||
+DateTime auto_close_at
|
||||
+DateTime paused_at
|
||||
+DateTime resolved_at
|
||||
+String closed_by
|
||||
+JSON meta
|
||||
+DateTime created_at
|
||||
+DateTime updated_at
|
||||
}
|
||||
|
||||
class AutoAction {
|
||||
+String id
|
||||
+String session_id
|
||||
+Integer action_index
|
||||
+String action_type
|
||||
+String adapter
|
||||
+String risk_level
|
||||
+String title
|
||||
+String description
|
||||
+String status
|
||||
+JSON payload
|
||||
+JSON result
|
||||
+String error
|
||||
+String approved_by
|
||||
+DateTime approved_at
|
||||
}
|
||||
|
||||
class InformationItem {
|
||||
+String id
|
||||
+String session_id
|
||||
+String name
|
||||
+String value
|
||||
+JSON modifiers
|
||||
+Boolean is_filled
|
||||
+Boolean is_locked
|
||||
+Integer version
|
||||
+JSON update_history
|
||||
+DateTime created_at
|
||||
+DateTime updated_at
|
||||
}
|
||||
|
||||
class ApprovalTicket {
|
||||
+String id
|
||||
+String action_id
|
||||
+String session_id
|
||||
+String approver_id
|
||||
+String channel
|
||||
+String status
|
||||
+String reason
|
||||
+String decision_note
|
||||
+DateTime decided_at
|
||||
}
|
||||
|
||||
class ScenarioConfig {
|
||||
+String id
|
||||
+String scenario_key
|
||||
+String name
|
||||
+String description
|
||||
+Boolean enabled
|
||||
+JSON trigger_conditions
|
||||
+JSON actions
|
||||
+JSON approval_strategy
|
||||
+String current_version_id
|
||||
}
|
||||
}
|
||||
|
||||
%% ==================== 服务层 ====================
|
||||
namespace Services {
|
||||
class IntentRouter {
|
||||
-db: AsyncSession
|
||||
-audit: Any
|
||||
+detect(description: str, employee_id: str) Dict
|
||||
+detect_global_intent(text: str) Dict
|
||||
-_keyword_fallback_global(text: str) Dict
|
||||
}
|
||||
|
||||
class DifyClient {
|
||||
-base_url: str
|
||||
-api_key: str
|
||||
-timeout: float
|
||||
+detect_intent(description: str, employee_id: str) Dict
|
||||
-_parse_intent(answer: str) Dict
|
||||
-_parse_global_intent(answer: str) Dict
|
||||
-_fallback_intent(description: str) Dict
|
||||
-_fallback_global_intent(text: str) Dict
|
||||
+test_connection() Dict
|
||||
}
|
||||
|
||||
class AutoSessionService {
|
||||
-db: AsyncSession
|
||||
-redis: Any
|
||||
-audit: Any
|
||||
+create_session(...) AutoSession
|
||||
+get_session(session_id) AutoSession
|
||||
+list_sessions(...) List
|
||||
+start(session_id) void
|
||||
+pause_session(session_id, reason) AutoSession
|
||||
+resume_session(employee_id, session_id) dict
|
||||
+list_paused_sessions(employee_id) List
|
||||
+correct_info(session_id, field, new_value) InformationItem
|
||||
+supplement_info(session_id, field, value) InformationItem
|
||||
+agent_resume(session_id, agent_id) AutoSession
|
||||
+agent_close(session_id, agent_id) AutoSession
|
||||
+takeover(session_id, agent_id) AutoSession
|
||||
+resolve_feedback(session_id, satisfied) AutoSession
|
||||
-_build_resume_point(session) dict
|
||||
-_save_resume_point(session, snapshot) void
|
||||
-_load_resume_point(session_id) dict
|
||||
}
|
||||
|
||||
class InformationItemService {
|
||||
-db: AsyncSession
|
||||
-redis: Any
|
||||
+create_item(session_id, name, value, modifiers) InformationItem
|
||||
+get_items(session_id) List~InformationItem~
|
||||
+get_item(session_id, name) InformationItem
|
||||
+correct_value(session_id, name, new_value) InformationItem
|
||||
+supplement_value(session_id, name, value) InformationItem
|
||||
+lock_items_for_action(session_id, action_id) void
|
||||
+check_downstream_impact(session_id, field) bool
|
||||
+get_pending_required_items(session_id) List~str~
|
||||
}
|
||||
|
||||
class ActionExecutor {
|
||||
-db: AsyncSession
|
||||
-redis: Any
|
||||
-audit: Any
|
||||
-approval: ApprovalService
|
||||
-rollback: RollbackService
|
||||
+run(session_id) void
|
||||
+resume(session_id, action_id, decision) void
|
||||
-_do_execute(session, action, mapping, clients) void
|
||||
-_on_action_failed(session, action, exc) void
|
||||
-_finish_success(session) void
|
||||
}
|
||||
|
||||
class TimeoutCleaner {
|
||||
-db_factory: async_sessionmaker
|
||||
-redis: Any
|
||||
+run_once() int
|
||||
+run_scheduled(interval: int) void
|
||||
-_scan_and_close() int
|
||||
-_notify_timeout(session_id) void
|
||||
}
|
||||
|
||||
class ProgressPublisher {
|
||||
+publish_progress(session_id, step, message) void
|
||||
+publish_action_required(session_id, action, ticket) void
|
||||
+publish_resolved(session_id, summary) void
|
||||
+publish_takeover(session_id, reason) void
|
||||
+publish_error(session_id, code, message) void
|
||||
+publish_paused(session_id, title, paused_at, hint) void
|
||||
+publish_resumed(session_id, title, resumed_at, step) void
|
||||
+publish_timeout_closed(session_id, closed_at, reason) void
|
||||
+publish_info_corrected(session_id, field, old, new, ver) void
|
||||
+publish_info_supplemented(session_id, field, supp, new) void
|
||||
-_publish(event_type, session_id, data) void
|
||||
}
|
||||
}
|
||||
|
||||
%% ==================== Schema 层 ====================
|
||||
namespace Schemas {
|
||||
class GlobalIntentResult {
|
||||
+Optional~str~ global_intent
|
||||
+Optional~str~ scenario_key
|
||||
+float confidence
|
||||
+Optional~str~ corrected_field
|
||||
+Optional~str~ old_value
|
||||
+Optional~str~ new_value
|
||||
+Optional~str~ supplement_field
|
||||
+Optional~str~ supplement_value
|
||||
+str raw
|
||||
+str error
|
||||
}
|
||||
|
||||
class PauseRequest {
|
||||
+Optional~str~ reason
|
||||
}
|
||||
|
||||
class ResumeRequest {
|
||||
+Optional~str~ session_id
|
||||
}
|
||||
|
||||
class CorrectRequest {
|
||||
+str field
|
||||
+str new_value
|
||||
+Optional~str~ old_value
|
||||
}
|
||||
|
||||
class SupplementRequest {
|
||||
+str field
|
||||
+str value
|
||||
}
|
||||
|
||||
class InformationItemResponse {
|
||||
+str id
|
||||
+str session_id
|
||||
+str name
|
||||
+str value
|
||||
+List~str~ modifiers
|
||||
+bool is_filled
|
||||
+bool is_locked
|
||||
+int version
|
||||
+List~dict~ update_history
|
||||
+Optional~str~ updated_at
|
||||
}
|
||||
|
||||
class ResumePointResponse {
|
||||
+str session_id
|
||||
+str title
|
||||
+Optional~str~ scenario_key
|
||||
+str current_step
|
||||
+Optional~str~ paused_at
|
||||
+List~str~ pending_items
|
||||
+List~InformationItemResponse~ info_items
|
||||
}
|
||||
|
||||
class PausedSessionItem {
|
||||
+str session_id
|
||||
+str title
|
||||
+Optional~str~ scenario_key
|
||||
+Optional~str~ paused_at
|
||||
+str paused_duration
|
||||
}
|
||||
}
|
||||
|
||||
%% ==================== 关系 ====================
|
||||
AutoSession "1" --> "*" InformationItem : session_id 关联
|
||||
AutoSession "1" --> "*" AutoAction : session_id 关联
|
||||
AutoSession "1" --> "*" ApprovalTicket : session_id 关联
|
||||
ScenarioConfig --> AutoSession : scenario_key 匹配
|
||||
|
||||
AutoSessionService --> AutoSession : 管理生命周期
|
||||
AutoSessionService --> InformationItemService : 委托信息项操作
|
||||
AutoSessionService --> IntentRouter : 使用意图识别
|
||||
AutoSessionService --> ActionExecutor : 调用续行执行
|
||||
AutoSessionService --> ProgressPublisher : 推送事件
|
||||
|
||||
IntentRouter --> DifyClient : 调用 Dify 识别
|
||||
InformationItemService --> InformationItem : CRUD
|
||||
TimeoutCleaner --> AutoSessionService : 调用 auto_close
|
||||
TimeoutCleaner --> ProgressPublisher : 推送超时事件
|
||||
ProgressPublisher --> AutoSession : 推送状态变更
|
||||
|
||||
InformationItemResponse ..> InformationItem : 序列化
|
||||
ResumePointResponse ..> InformationItemResponse : 包含
|
||||
GlobalIntentResult ..> IntentRouter : 返回类型
|
||||
```
|
||||
Reference in New Issue
Block a user