8 Commits

Author SHA1 Message Date
wangdl
0889e3af46 feat: knowledge generation workflow + drop import-candidate module + migrations
All checks were successful
Deploy API Server / build (push) Successful in 36s
Deploy API Server / deploy (push) Successful in 1m0s
2026-07-08 19:34:10 +08:00
wangdl
f1eb99b6fa fix(quiz): complete cross-platform attempt and question type contract
Some checks failed
Deploy API Server / build-and-unit (push) Failing after 42s
Deploy API Server / current-integration (push) Has been skipped
Deploy API Server / backward-compat (push) Has been skipped
Deploy API Server / deploy (push) Has been skipped
- Add attempt lifecycle with per-attempt answer visibility (#336)
- Add atomic submission with updateMany CAS + $transaction (#337)
- Add iOS attempt-based question loading + local answer cache (#338)
- Freeze choice/fill/judge cross-platform contract with fill grading (#339)
- Add per-question-type learning analysis accuracyByQuestionType (#340)
- Add GATE E2E test suite with 17 scenarios (#341)
- CLEANUP-01: Remove illegal type → choice silent degradation
- CLEANUP-02: Integrate QuizQuestionType enum into iOS quiz views
- CLEANUP-03: Test verification, git delivery, targeted gate review

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-24 19:55:05 +08:00
wangdl
c3b8919489 fix(M-AI-07-06): answer leak fixes (A3/A4) + state compatibility
Some checks failed
Deploy API Server / build-and-unit (push) Successful in 37s
Deploy API Server / current-integration (push) Successful in 30s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / deploy (push) Failing after 49s
- getQuizQuestions: only return answer/explanation after user has submitted
- findOne: remove questions include (use getQuizQuestions instead)
- State mapping: lifecycleStatus compatible with legacy status field

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-22 20:51:03 +08:00
wangdl
b0e9796acb fix: use ConfigService for DeepSeek base URL in testCredential
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 43s
- Replace hardcoded 'https://api.deepseek.com/v1/models' with config lookup
- Single source of truth via ai.deepseek.baseUrl (DEEPSEEK_BASE_URL env)
- Add ConfigService dep to UserAiService constructor + test mock

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 11:47:59 +08:00
wangdl
7aea03f6e0 fix: clarify quota check is read-only, prevent refactoring pitfalls
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 46s
- Rename checkAndReserve→checkQuota (method only reads, does not reserve)
- Add doc comment: incrementJobCount is the actual quota reservation
- Update user-ai.service.spec.ts references
- Add comments for apiKeyMode/credentialId reassignment in budget fallback

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 11:36:01 +08:00
wangdl
c88af39673 feat: AI Runtime 完整业务逻辑实现
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 45s
- runtime-internal.service: resolveSnapshot 自动重建、persistResult 5种jobType持久化、validateOutput 校验、convertQuizCandidates/convertFlashcardCandidates 候选转换、notifyJobComplete 通知、JOB_CANCELLED处理、heartbeat 双阶段更新+取消检测
- user-ai.service: createAnalysisJob 11步流程、cancelJob、publishQuiz/publishFlashcard、getAnalysis/listAnalyses等
- user-ai.controller: 20+ 用户API端点
- 新增服务: SnapshotBuilderService、PriorityRulesService、SnapshotCleanupService、JobReaperService
- 新增模块: admin-learning (CRUD管理)
- Prisma schema: cancelRequestedAt/cancelledAt/sourceBlockIds 字段、expiresAt 索引
- 文档: ai-runtime-user-api.md、Issue 记录

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 11:22:03 +08:00
wangdl
cc2ccbad59 fix: audit fixes for Runtime Internal API
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 46s
1. heartbeat: locked→running transition on first heartbeat
2. submitResult: validate job is locked/running before accepting
3. submitFailure: validate job is locked/running before accepting
4. resolveCredentialForJob: update lastUsedAt on credential
5. pollJobs: filter by capabilities (snapshotVersion + outputSchemaVersion)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 21:38:44 +08:00
wangdl
4cf2aa99fd feat: 用户 AI 设置与 Key 管理 API (API-AI-011~015)
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 10s
- UserAiController: GET/PUT /ai/profile, GET/PUT /ai/settings
- UserAiController: CRUD /ai/model-credentials, POST test
- UserAiService: Profile upsert, Settings默认创建, Key 生命周期
- CredentialEncryptionService: AES-256-GCM 加解密, SHA-256 hash, mask脱敏, 日志redact
- AiRuntimeModule 注册到 AppModule

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 20:39:29 +08:00