```
feat(AI): 集成MNN推理引擎替换MLX作为主AI运行时 - 引入MNN(alibaba) + Arm SME2 + CPU作为主AI运行时,支持A19/iPhone17的 SME2和A17的NEON加速 - 添加MLX Swift作为兜底GPU推理方案,实现双后端切换机制 - 使用单一Qwen3.5-2B多模态模型(1.2GB),替代原有的LLM+VL分离架构 - 实现InferenceEngine.current引擎选择逻辑,真机默认MNN,模拟器回退MLX - 更新AIAgent架构,通过MNNLLMBridge(ObjC++) → MNNBackend进行推理 - 修改队列机制防止并发推理导致OOM,使用信号量闸门控制显存占用 - 更新文档中的技术栈说明、模块边界和周次交付计划 ```
This commit is contained in:
@@ -42,10 +42,12 @@ struct TimelineEntry: Identifiable, Hashable {
|
||||
let kind: TimelineKind
|
||||
let date: Date
|
||||
let title: String
|
||||
let subtitle: String
|
||||
var subtitle: String
|
||||
let trailing: String?
|
||||
let trailingIsAlert: Bool
|
||||
let isOngoing: Bool
|
||||
/// 同名指标聚合后的累计次数(>1 时副标题附「共 N 次」)。非聚合条目恒为 1。
|
||||
var aggregateCount: Int = 1
|
||||
|
||||
static func from(indicator i: Indicator) -> TimelineEntry {
|
||||
TimelineEntry(
|
||||
@@ -87,6 +89,34 @@ struct TimelineEntry: Identifiable, Hashable {
|
||||
return entries
|
||||
}
|
||||
|
||||
/// 「记录」列表 / 首页最近记录用:把同名(同类组)指标聚合成一条,代表取最新一次,
|
||||
/// 附带该组累计次数(`aggregateCount`,>1 时副标题缀「共 N 次」)。
|
||||
/// 点代表条目跳 `IndicatorSeriesDetailView` 看历次。分组口径与聚合详情 / 趋势一致
|
||||
/// (`IndicatorGroup`):血压(bp.*)并一组、有 seriesKey 的按 key、无 seriesKey 的按 name+unit 归一。
|
||||
static func aggregatedIndicators(_ indicators: [Indicator]) -> [TimelineEntry] {
|
||||
var order: [String] = []
|
||||
var groups: [String: [Indicator]] = [:]
|
||||
for i in indicators {
|
||||
let key = IndicatorGroup.of(i).id
|
||||
if groups[key] == nil { order.append(key) }
|
||||
groups[key, default: []].append(i)
|
||||
}
|
||||
return order.compactMap { key -> TimelineEntry? in
|
||||
guard let members = groups[key] else { return nil }
|
||||
// 该组逐条条目(血压已合并 sys/dia),取最新一条作代表。
|
||||
guard var rep = from(indicators: members).max(by: { $0.date < $1.date }) else { return nil }
|
||||
// 次数:血压按测量次数(bp.systolic 条数),其余按成员条数。
|
||||
let count = key == IndicatorGroup.bloodPressure.id
|
||||
? members.filter { $0.seriesKey == "bp.systolic" }.count
|
||||
: members.count
|
||||
rep.aggregateCount = count
|
||||
if count > 1 {
|
||||
rep.subtitle += " · " + String(appLoc: "共 \(count) 次")
|
||||
}
|
||||
return rep
|
||||
}
|
||||
}
|
||||
|
||||
private static func mergedBP(systolic sys: Indicator, diastolic dia: Indicator) -> TimelineEntry {
|
||||
let abnormal = sys.status != .normal || dia.status != .normal
|
||||
// 方向箭头按实际 status 给:两值同向才标 ↑/↓;一高一低只标红不给方向
|
||||
|
||||
Reference in New Issue
Block a user