link2026
|
e7cdb45472
|
harden(ai): AIRuntime 去掉冗余 weak self,prepare loading 路径加注释
按 code quality review 反馈(2×P0):
- generate() 的 Task 闭包不再 [weak self];actor 单例 strong capture
没有循环引用风险,且避免 Swift 5.10+ weak-on-actor 警告
- prepare() 的 case .loading: return 加注释说明这是有意设计,
调用方需轮询或显示 loading UI(W3 引入 prepare 队列优化)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-25 15:33:51 +08:00 |
|
link2026
|
4dcd951821
|
feat(ai): add AIRuntime actor skeleton + TokenChunk
按 W2 plan Task 5 落地推理串行化骨架:
- TokenChunk: Sendable struct (text + decodeRate tok/s)
- AIRuntime: actor 单例
- Status: notReady / loading / ready / error(msg)
- prepare() async throws: 幂等加载,失败回滚 status
- generate(prompt:maxTokens:) -> AsyncThrowingStream: 流式输出
跨 actor 边界用 snapshot 模式捕获 self.status/llmSession
- lastDecodeRate: 给 UI 顶部条 / Live Activity 取
- AIRuntimeError: LocalizedError, 三种 case
WIP: Build will fail until Task 6 lands LLMSession (intentional).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-25 15:30:47 +08:00 |
|