实现酒店上下文单酒店收口

This commit is contained in:
andy
2026-07-10 15:31:51 +08:00
parent 7492c21350
commit d69f3975ef
52 changed files with 1183 additions and 188 deletions

View File

@@ -32,10 +32,11 @@
| 用例 ID | 场景 | 输入要点 | 期望结果 |
| --- | --- | --- | --- |
| MCP-T01-001 | 按 group code 查询 | `hotel_id` + `group_code` | 返回成功 envelope |
| MCP-T01-002 | 按 confirmation 查询 | `hotel_id` + `confirmation_number` | 返回成功 envelope |
| MCP-T01-003 | 缺少查询 key | 只有 `hotel_id` | 返回 `QUERY_KEY_REQUIRED` |
| MCP-T01-004 | 缺 hotel id | 不传 `hotel_id` | 返回 `HOTEL_ID_REQUIRED` |
| MCP-T01-001 | 按 group code 查询 | `group_code``hotel_id` 可选 | 返回成功 envelope |
| MCP-T01-002 | 按 confirmation 查询 | `confirmation_number``hotel_id` 可选 | 返回成功 envelope |
| MCP-T01-003 | 缺少查询 key | 不传 `group_code``confirmation_number` | 返回 `QUERY_KEY_REQUIRED` |
| MCP-T01-004 | 缺 hotel id | 不传 `hotel_id`,传 `group_code` | 后端按系统唯一 ACTIVE 酒店查询并返回成功 envelope |
| MCP-T01-005 | hotel id 不一致 | 传非系统酒店 `hotel_id` | 返回 `HOTEL_ACCESS_DENIED``HOTEL_ID_MISMATCH` |
## 5. th_hotel_query_object_detail
@@ -87,8 +88,9 @@
| MCP-T05-002 | 提交 manual review | `result_type=manual_review` | 写入人工复核任务 |
| MCP-T05-003 | 提交 informational message | `result_type=informational_message` | 写入提示类信息 |
| MCP-T05-004 | source message 不存在 | 不存在的外部 `source_message_id` | 返回 `SOURCE_MESSAGE_NOT_FOUND` |
| MCP-T05-005 | 缺 hotel id | 不传 `hotel_id` | 返回 `HOTEL_ID_REQUIRED` |
| MCP-T05-005 | 缺 hotel id | 不传 `hotel_id`source message 属于系统酒店 | 后端按系统唯一 ACTIVE 酒店写入成功 |
| MCP-T05-006 | 重复提交同一幂等任务 | 使用相同幂等信息 | 不重复创建业务任务 |
| MCP-T05-007 | hotel id 不一致 | 显式传非系统酒店 `hotel_id` | 返回 `HOTEL_ID_MISMATCH` |
写入验证:

View File

@@ -17,6 +17,7 @@
| 字段 | 默认值 | 中文说明 |
| --- | --- | --- |
| `hotel_id` | 后端解析 | SuperAgent 默认不传;单酒店阶段由 TH Hotel 后端从 `platform_hotel` 唯一 `ACTIVE` 酒店解析,兼容旧调用传入时必须与系统酒店一致。 |
| `source_provider` | `AGENTBUS` | 来源提供方 |
| `source_channel` | `EMAIL` | 来源渠道 |
@@ -65,8 +66,8 @@
"additionalProperties": false,
"properties": {
"hotel_id": {
"type": "string",
"description": "酒店上下文 ID"
"type": ["string", "null"],
"description": "可选酒店上下文 ID;默认由 TH Hotel 后端解析"
},
"group_code": {
"type": ["string", "null"],
@@ -93,7 +94,7 @@
"description": "历史线程 key 是否仅作为证据"
}
},
"required": ["hotel_id"]
"required": []
}
```
@@ -135,8 +136,8 @@ POST /api/ai-query/v1/case-context
"additionalProperties": false,
"properties": {
"hotel_id": {
"type": "string",
"description": "酒店上下文 ID"
"type": ["string", "null"],
"description": "可选酒店上下文 ID;默认由 TH Hotel 后端解析"
},
"object_id": {
"type": "string",
@@ -147,7 +148,7 @@ POST /api/ai-query/v1/case-context
"description": "调用方对象类型提示"
}
},
"required": ["hotel_id", "object_id"]
"required": ["object_id"]
}
```
@@ -193,8 +194,8 @@ SuperAgent 提交任务结果时的外部 `source_message_id`。
"additionalProperties": false,
"properties": {
"hotel_id": {
"type": "string",
"description": "酒店上下文 ID"
"type": ["string", "null"],
"description": "可选酒店上下文 ID;默认由 TH Hotel 后端解析"
},
"source_provider": {
"type": ["string", "null"],
@@ -213,7 +214,7 @@ SuperAgent 提交任务结果时的外部 `source_message_id`。
"description": "外部来源消息 ID可作为锚点反查会话"
}
},
"required": ["hotel_id"]
"required": []
}
```
@@ -221,7 +222,7 @@ SuperAgent 提交任务结果时的外部 `source_message_id`。
- `external_conversation_id``source_message_id` 至少一个非空。
- 两者同时传入时,后端按 `external_conversation_id` 查询为准。
- 查询`hotel_id + source_provider + source_channel + external_conversation_id` 隔离。
- 查询最终按“后端解析出的酒店 ID + source_provider + source_channel + external_conversation_id隔离。
### 5.4 输出
@@ -282,8 +283,8 @@ POST /api/ai-query/v1/message-conversation/tasks
"additionalProperties": false,
"properties": {
"hotel_id": {
"type": "string",
"description": "酒店上下文 ID"
"type": ["string", "null"],
"description": "可选酒店上下文 ID;默认由 TH Hotel 后端解析"
},
"source_provider": {
"type": ["string", "null"],
@@ -302,7 +303,7 @@ POST /api/ai-query/v1/message-conversation/tasks
"description": "外部来源消息 ID可作为锚点反查会话"
}
},
"required": ["hotel_id"]
"required": []
}
```
@@ -334,14 +335,14 @@ POST /api/ai-query/v1/message-conversation/messages
### 7.2 何时使用
- SuperAgent 已完成当前邮件的最终任务拆分。
- 已确认 `hotel_id`外部 `source_message_id` 来自 AgentBus payload。
- 已确认外部 `source_message_id` 来自 AgentBus payload`hotel_id` 由 TH Hotel 后端解析
- 需要把 AI 任务结果交给 TH Hotel 后端进入人工确认流程。
### 7.3 不应使用
- 不应在试探、草稿、未完成推理阶段调用。
- 不应把历史邮件中的外部来源消息 ID 当作当前邮件 ID 提交。
- 不应在缺少 `hotel_id``source_message_id` 时调用。
- 不应在缺少 `source_message_id` 时调用`hotel_id` 不需要 SuperAgent 提供
### 7.4 输入 Schema
@@ -351,8 +352,8 @@ POST /api/ai-query/v1/message-conversation/messages
"additionalProperties": false,
"properties": {
"hotel_id": {
"type": "string",
"description": "酒店上下文 ID"
"type": ["string", "null"],
"description": "可选酒店上下文 ID;默认由 TH Hotel 后端解析"
},
"source_provider": {
"type": ["string", "null"],
@@ -381,7 +382,7 @@ POST /api/ai-query/v1/message-conversation/messages
}
}
},
"required": ["hotel_id", "source_message_id", "ai_task_results"]
"required": ["source_message_id", "ai_task_results"]
}
```