feat: 支持 AskUserQuestion 多问题和多选功能

- 新增 QuestionItem 类型支持单个问题配置(question/options/multiSelect)
   - AskUserEvent 改为 questions 数组支持多问题
   - AnswerRequest 新增 answers 字段支持多问题答案提交
   - 前端渲染支持单选按钮(radio)和多选复选框(checkbox)
   - 答案格式:{\"0\": [\"选项1\"], \"1\": [\"选项A\", \"选项B\"]}
   - 保持向后兼容旧的单问题格式
This commit is contained in:
Roe-xin
2026-03-05 16:58:59 +08:00
parent f6b1f5c45a
commit fa55e32153
7 changed files with 132 additions and 74 deletions

View File

@ -194,11 +194,17 @@ export interface PlanSummaryUpdateEvent {
timestamp: number;
}
/** 单个问题项 */
export interface QuestionItem {
question: string;
options: string[];
multiSelect?: boolean;
}
/** ask_user 事件数据 */
export interface AskUserEvent {
askId: string;
question: string;
options: string[];
questions: QuestionItem[];
}
/** complete 事件数据 */
@ -351,10 +357,12 @@ export interface AnswerRequest {
askId: string;
/** 任务ID */
taskId: string;
/** 选中的选项列表 */
/** 选中的选项列表(旧格式,兼容) */
selected?: string[];
/** 自定义输入内容 */
/** 自定义输入内容(旧格式,兼容) */
customInput?: string;
/** 新格式:按问题索引的答案 */
answers?: { [questionIndex: string]: string[] };
}
/** 用户回答响应 */