| 1 | export type FirstFrameQuestionIntent = |
| 2 | | "confirm_uploaded" |
| 3 | | "decline_upload" |
| 4 | | "request_edit" |
| 5 | | "confirm_edit_done" |
| 6 | | "other"; |
| 7 | |
| 8 | const CONFIRM_UPLOADED = new Set([ |
| 9 | "需要上传,已上传完毕", |
| 10 | "已上传完毕", |
| 11 | "已上传", |
| 12 | "确认上传", |
| 13 | ]); |
| 14 | |
| 15 | const DECLINE_UPLOAD = new Set(["不上传", "无需上传"]); |
| 16 | |
| 17 | const REQUEST_EDIT = new Set([ |
| 18 | "我想修改/增删参考图", |
| 19 | "我要修改/增删参考图", |
| 20 | "需要上传", |
| 21 | ]); |
| 22 | |
| 23 | export function classifyFirstFrameQuestion( |
| 24 | label: string, |
| 25 | question?: string, |
| 26 | ): FirstFrameQuestionIntent { |
| 27 | const trimmed = label.trim(); |
| 28 | if (CONFIRM_UPLOADED.has(trimmed)) return "confirm_uploaded"; |
| 29 | if (DECLINE_UPLOAD.has(trimmed)) return "decline_upload"; |
| 30 | if (REQUEST_EDIT.has(trimmed)) return "request_edit"; |
| 31 | if (trimmed === "是" && (question ?? "").includes("参考图")) { |
| 32 | return "confirm_edit_done"; |
| 33 | } |
| 34 | return "other"; |
| 35 | } |
| 36 |