feat: AI 调用改为异步任务并支持结果重复获取

This commit is contained in:
2026-10-09 15:07:15 +08:00
parent 0b695f54bf
commit cf380c5f09
37 changed files with 1911 additions and 189 deletions
@@ -234,8 +234,12 @@ public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, S
/**
* 生成学习报告草稿:优先调用 lpt-ai 聚合残片,服务不可用时降级为按序拼接。
* 草稿仅作为编辑起点返回,不落库——最终报告由用户确认后经 endedStudySession 保存。
*
* <p>由 AI 任务执行器在请求线程之外调用(AI-02):聚合可能等待 AI 数分钟,
* 不能放在读取接口里,否则一个 GET 就会阻塞并按 AI 计费。</p>
*/
public String generateReportDraft(String sessionNum) throws ErrorParameterException {
@Override
public String buildReportDraft(String sessionNum) throws ErrorParameterException {
StudySessionsEntity session = this.getOneOpt(Wrappers.lambdaQuery(StudySessionsEntity.class)
.eq(StudySessionsEntity::getSessionNum, sessionNum))
.orElseThrow(() -> sessionNotFound(sessionNum));