[M-AI-07-03] 实现 Quiz Generation Executor 与题目输出验证 #322
Closed
opened 2026-06-22 20:23:23 +08:00 by wangdl
·
1 comment
Labels
Clear labels
adr
Area: adr
architecture
Area: architecture
area:activity
活动/统计
area:admin
管理后台
area:admin-api
area:ai
AI/RAG
area:ai-runtime
AI Runtime / AI 分析体系相关
area:analytics
area:api
API 接口
area:auth
认证与授权
area:cos
对象存储
area:database
数据库/Migration
area:import
文件导入/解析
area:knowledge
知识库/知识点
area:learning-info
area:learning-session
area:quiz
测验/自测
area:reading-event
area:reading-progress
area:review
复习系统
area:security
安全相关
audit
Area: audit
audit:api-admin-info
audit:api-info
audit:planned
已完成宏观规划,尚未代码审查
audit:reviewed
backend
Area: backend
billing
Area: billing
blocked-by:api-info-aggregation
blocked-by:api-info-core
blocked-by:api-info-ops
blocked-by:api-info-schema
blocked-by:processor
blocked-by:schema
compatibility
Area: compatibility
gate
Area: gate
infrastructure
Area: infrastructure
priority:p0
最高优先级,阻塞发布
priority:p1
高优先级,里程碑必需
priority:p2
中优先级,后续版本
prisma
Area: prisma
release
Area: release
repo:api
API 仓库 Issue
status:blocked
被阻塞
status:done
已完成
status:partial
status:todo
type:aggregation
type:bug
缺陷修复
type:design
设计
type:docs
文档
type:feature
新功能
type:migration
type:refactor
重构
type:test
work:admin-api
work:aggregation
work:api
work:artifact
题目/卡片产物
work:audit
work:circuit-breaker
熔断
work:contract
work:design
架构/协议设计工作
work:docs
work:export
work:extend-existing
work:internal-api
Runtime 内部接口
work:job
Job 调度相关
work:new-module
work:new-table
work:ops
work:query
work:quota
额度/限流
work:schema
Prisma Schema 设计
work:security
work:service
Service 层实现
work:snapshot
Snapshot 构建
work:test
No Label
Milestone
No items
No Milestone
M-AI-07 Quiz 生成与题目产物统一引擎迁移
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wangdl/api-server#322
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
类型 / 标签
风险等级
P1 — 验证缺失会导致非法输出进入数据库;Prompt 语义偏离会导致题目质量下降
依赖
目标
将现有 Quiz AI Workflow 适配到统一 AiJob Engine,保持现有 Prompt、模型策略和题目语义。
Executor
新增
QuizGenerationExecutor。职责:从 Snapshot 构造模型输入、调用 AiGatewayService、使用冻结 Prompt、接收 AbortSignal、返回结构化输出、不写数据库。禁止:直接调用 Provider SDK、注入 PrismaService、直接创建 Quiz/Question、直接写 Job 状态、自行处理 BullMQ Retry。Prompt 兼容
对比 Legacy Workflow:Prompt Key、Prompt Version、system message、user message、questionCount、questionTypes、difficulty、language、temperature、maxTokens、modelTier、output schema。不要求自然语言逐字相同,但不得改变业务语义。
Schema + Business Validator
按题型验证:单选题(≥2 选项、不重复、1 个正确答案)、多选题(≥2 选项、≥1 正确答案、不超限)、判断题(true/false)、主观题(无 options、有参考答案和解析)。通用规则:题目不重复、题干非空、解析非空、无 Markdown 代码围栏、无系统 Prompt、无模型指令、文本不超限、不引用 Snapshot 外知识点。
测试覆盖
正常输出、非法 JSON、空 Quiz、题数越界、非法题型、重复题目、重复选项、正确答案不存在、多选/判断答案错误、主观题无参考答案、超长文本、非法引用、AbortSignal、Provider 失败。
验收标准
建议执行顺序
第 3 个执行
开发完成评论
完成内容
修改文件
测试情况
是否建议进入 Review