feat(me,home): 模型推理自检 + 启动容错 + 首页假数据清理
- KangkangApp: ModelContainer 创建失败时重置本地 store 重建, 避免 demo 阶段 schema 演进导致旧真机启动崩溃(注:生产需正式迁移) - ModelSelfTestView: 正式的推理自检页(固定 prompt + 流式输出 + tok/s), 仅当 LLM 模型就绪时从「模型管理」出现入口 - 删除 DEBUG-only 的 DebugAIRunner,自检转正为就绪后可见的正式入口 - HomeView: 删除写死的「今日摘记」假数据卡;问候改为按时段动态 (早安/下午好/晚上好)+ 当天日期;影像档案数字接真实 @Query 计数 - MeView: 模型管理卡动态状态 + 关于页接真实版本号(用户改动一并纳入) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -40,9 +40,6 @@ struct HomeView: View {
|
||||
OngoingSymptomsCard()
|
||||
.padding(.bottom, 18)
|
||||
|
||||
todaySummaryCard
|
||||
.padding(.bottom, 18)
|
||||
|
||||
recentSection
|
||||
.padding(.bottom, 22)
|
||||
|
||||
@@ -57,11 +54,11 @@ struct HomeView: View {
|
||||
private var greeting: some View {
|
||||
HStack(alignment: .top) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text("5 月 25 日 · 周一")
|
||||
Text(todayLine)
|
||||
.font(.system(size: 12))
|
||||
.tracking(1)
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
Text("早安,林意")
|
||||
Text(greetingWord)
|
||||
.font(.tjTitle())
|
||||
.foregroundStyle(Tj.Palette.text)
|
||||
}
|
||||
@@ -71,48 +68,19 @@ struct HomeView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var todaySummaryCard: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack(spacing: 10) {
|
||||
Text("今日 · 摘记")
|
||||
.font(.system(size: 12, weight: .semibold))
|
||||
.tracking(0.3)
|
||||
.foregroundStyle(Tj.Palette.brick)
|
||||
.fixedSize()
|
||||
Rectangle()
|
||||
.fill(Tj.Palette.line)
|
||||
.frame(height: 1)
|
||||
Text("本机摘要")
|
||||
.font(.system(size: 11))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
.fixedSize()
|
||||
}
|
||||
.padding(.bottom, 10)
|
||||
private var todayLine: String {
|
||||
let f = DateFormatter()
|
||||
f.locale = Locale(identifier: "zh_CN")
|
||||
f.dateFormat = "M 月 d 日 · EEE"
|
||||
return f.string(from: Date())
|
||||
}
|
||||
|
||||
Text("上次体检后,\(Text("低密度脂蛋白").underline(color: Tj.Palette.brick).foregroundColor(Tj.Palette.text))持续偏高已 3 个月。建议本周记录一次空腹血脂。")
|
||||
.font(.tjSerifBody())
|
||||
.foregroundStyle(Tj.Palette.text)
|
||||
.lineSpacing(6)
|
||||
.padding(.bottom, 14)
|
||||
|
||||
HStack(spacing: 14) {
|
||||
Button("记录今日") {}
|
||||
.buttonStyle(TjPrimaryButton(height: 34, fontSize: 13, horizontalPadding: 14))
|
||||
Button("查看趋势") {}
|
||||
.buttonStyle(TjGhostButton(height: 34, fontSize: 13, horizontalPadding: 14))
|
||||
}
|
||||
private var greetingWord: String {
|
||||
switch Calendar.current.component(.hour, from: Date()) {
|
||||
case 5..<12: return "早安"
|
||||
case 12..<18: return "下午好"
|
||||
default: return "晚上好"
|
||||
}
|
||||
.padding(.leading, 20)
|
||||
.padding(.trailing, 18)
|
||||
.padding(.vertical, 18)
|
||||
.background(
|
||||
Tj.Palette.paper
|
||||
.overlay(alignment: .leading) {
|
||||
Tj.Palette.brick.frame(width: 3)
|
||||
}
|
||||
)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 2, style: .continuous))
|
||||
.shadow(color: Color(red: 0.196, green: 0.157, blue: 0.098).opacity(0.06), radius: 0, x: 0, y: 1)
|
||||
}
|
||||
|
||||
private var recentSection: some View {
|
||||
@@ -168,13 +136,13 @@ struct HomeView: View {
|
||||
|
||||
Button(action: onTapArchive) {
|
||||
HStack(spacing: 14) {
|
||||
TjPlaceholder(label: "档案 · 12")
|
||||
TjPlaceholder(label: "档案 · \(reports.count)")
|
||||
.frame(width: 56, height: 56)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("我的报告档案")
|
||||
.font(.system(size: 14, weight: .semibold))
|
||||
.foregroundStyle(Tj.Palette.text)
|
||||
Text("12 份 · 218 项指标 · 端侧加密")
|
||||
Text("\(reports.count) 份 · \(indicators.count) 项指标 · 端侧加密")
|
||||
.font(.system(size: 11))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user