Files
ZNJJ-api-server/docs/domain/event-mapping.md
2026-07-27 17:21:29 +08:00

38 lines
2.0 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.
# 历史输入到结构化事件的映射
API 兼容层可以继续接收历史字符串,但进入 LangGraph 前必须转换为以下事件。图节点不得再通过自然语言字符串判断系统事件。
| 历史输入 | 结构化事件 | 必要字段 | 确定性效果 |
|---|---|---|---|
| 普通用户文本 | `UserMessageEvent` | `event_id`, `text`, `need_form_update`, `use_text_chunk` | 进入当前阶段处理;自然语言轮次通常调用一次 LLM |
| `【开始】` | `SessionStartedEvent` | `event_id` | `1001 → 1002`,开始事故描述采集 |
| `【继续办理】` | `SessionStartedEvent` | `event_id` | 与 `【开始】` 相同 |
| `【拍摄完成】` | `PhotoCompletedEvent` | `event_id`, `photo_step` | 仅按单车/双车严格顺序推进一步0 次 LLM |
| `【客户端连续3次拍摄识别失败原因】` | `PhotoRecognitionFailedEvent` | `event_id`, `reason` | 任意照片阶段立即进入 `0005`0 次 LLM |
| `【用户无回复】` | `NoResponseEvent` | `event_id` | 第一次重复唤醒;连续第二次进入 `0004` |
| `【用户未回复】` | `NoResponseEvent` | `event_id` | 历史别名,效果同上 |
| `/set_info` 请求 | `SetInfoEvent` | `event_id`, `key`, `value` | 校验白名单/类型后幂等更新,不调用 LLM |
## 优先级
同一轮只允许一个输入事件。事件处理优先级为:
```text
显式人工请求
> 连续拍照失败
> 明确人伤/复杂情况
> 无回复
> 拍照完成
> 外部字段更新
> 普通用户文本
```
显式人工请求来自普通文本时允许确定性关键词 gate 先处理;语义模糊的人伤内容交由同一轮阶段 LLM 判断,但候选状态仍需迁移校验。
## 计数重置
- 收到有效用户回答后,`no_response_count` 清零。
- 当前问题得到有效答案后,对应 `clarification_counts[question_id]` 清零。
- 非连续的无回复不能累计到 `0004`
- 客户端已经负责累计三次拍照识别失败;服务端收到一次结构化失败事件就进入 `0005`,不得再次累计三次。