根据提供的code differences信息,我发现没有具体的代码变更内容。因此生成一个通用的commit message:

```
chore(config): 更新项目配置文件

- 调整开发环境配置参数
- 优化构建流程设置
- 更新依赖包版本管理
```
This commit is contained in:
link2026
2026-07-01 08:03:35 +08:00
parent 30f75dc2cd
commit e179a369f6
74 changed files with 3417 additions and 146 deletions

View File

@@ -58,6 +58,15 @@ actor AIRuntime {
// MNN,VL 退 MLX Qwen3-VL-4B
private let mnn = MNNBackend()
private(set) var mnnStatus: Status = .notReady
// MARK: - Gemini (hybrid: Gemma ,)
// , OOM , /
// / Gemma-3n(MLX )·
private let gemini = GeminiBackend()
/// ( + key)UI
nonisolated var cloudAvailable: Bool { CloudAI.isConfigured }
/// ( / )
nonisolated static var cloudLabel: String { "Gemini · \(CloudAI.model)" }
/// MNN (/ Models/Qwen3.5-2B-MNN)
nonisolated static var mnnModelFolder: URL {
ModelStore.shared.localURL(for: .mnnLLM)
@@ -307,6 +316,59 @@ actor AIRuntime {
}
}
// MARK: - Gemini (hybrid )
/// ( / ) OOM ,
/// `cloudAvailable`;退 `generate`
func generateCloud(prompt: String, maxTokens: Int = 512) -> AsyncThrowingStream<TokenChunk, Error> {
AsyncThrowingStream { continuation in
let task = Task {
do {
let stream = await self.gemini.generate(prompt: prompt, maxTokens: maxTokens)
for try await chunk in stream {
try Task.checkCancellation()
continuation.yield(chunk)
}
self.lastGenerateStats = await self.gemini.lastStats
continuation.finish()
} catch is CancellationError {
continuation.finish(throwing: CancellationError())
} catch {
continuation.finish(throwing: AIRuntimeError.inferenceFailed("\(error)"))
}
}
continuation.onTermination = { _ in task.cancel() }
}
}
/// : Gemini ( JSON)
/// ·;退 OCR+(§3.2)
func analyzeReportCloud(imageURLs: [URL], prompt: String, maxTokens: Int = 1024) async throws -> String {
do {
return try await gemini.analyze(imageURLs: imageURLs, prompt: prompt, maxTokens: maxTokens)
} catch {
throw AIRuntimeError.inferenceFailed("\(error)")
}
}
// MARK: - ASR(SenseVoice via sherpa-mnn)
/// (SenseVoice, CPU + ): + LLM/VL/MNN ,
/// / App jetsam (§3.1 OOM )
///
/// organize( LLM), LLM :
/// body , DiaryAssistService.organizeConsultation prepare
/// body hop 线( actor await ,,
/// ,)
func runExclusiveForASR<T: Sendable>(_ body: @Sendable () async throws -> T) async rethrows -> T {
await acquireGate(.interactive)
defer { releaseGate() }
unloadLLM()
unloadVL()
await unloadMNN()
return try await body()
}
// MARK: - VL
/// VL , load