```
feat(iOS): 更新MNN后端模型配置优化性能 将MNN主模型从Qwen3.5-4B(~2.64GiB)降级为Qwen3.5-2B(~1.1GiB),因为4B版本 实测运行过慢,影响用户体验。iPhone17+/SME2设备使用2B模型,保留MLX 兜底方案用于模拟器和备用场景,确保AI推理性能和存储效率的平衡。 ```
This commit is contained in:
@@ -182,6 +182,7 @@ struct DiaryQuickSheet: View {
|
||||
questionRow(index: roundLocalIndex(at: idx), question: q)
|
||||
}
|
||||
}
|
||||
AIDisclaimerFooter()
|
||||
}
|
||||
|
||||
if exhaustedNote {
|
||||
@@ -212,30 +213,12 @@ struct DiaryQuickSheet: View {
|
||||
? String(appLoc: "让 AI 帮我想想还能记什么")
|
||||
: String(appLoc: "先写几个字,AI 来帮忙补充"),
|
||||
enabled: canRequestSuggest,
|
||||
prominent: true,
|
||||
action: requestSuggestions
|
||||
)
|
||||
|
||||
case .loading:
|
||||
HStack(spacing: 10) {
|
||||
ProgressView().controlSize(.small)
|
||||
Text("AI 思考中… 本地推理,通常 5-10 秒")
|
||||
.font(.tjScaled( 13))
|
||||
.foregroundStyle(Tj.Palette.text2)
|
||||
Spacer()
|
||||
Button("取消") { cancelSuggestions() }
|
||||
.font(.tjScaled( 12, weight: .semibold))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
}
|
||||
.padding(.vertical, 11)
|
||||
.padding(.horizontal, 12)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
.fill(Tj.Palette.paper)
|
||||
)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
.strokeBorder(Tj.Palette.lineSoft, lineWidth: 1)
|
||||
)
|
||||
assistLoadingIndicator
|
||||
|
||||
case .ready:
|
||||
assistPrimaryButton(
|
||||
@@ -273,26 +256,25 @@ struct DiaryQuickSheet: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// 辅助主按钮。`prominent` 为真走实心强调样式(填充 brick + 白字 + 轻投影,一眼可点),
|
||||
/// 否则走低调描边样式(用于 .ready 的「再问一轮」)。
|
||||
private func assistPrimaryButton(icon: String,
|
||||
label: String,
|
||||
enabled: Bool,
|
||||
prominent: Bool = false,
|
||||
action: @escaping () -> Void) -> some View {
|
||||
Button(action: action) {
|
||||
HStack(spacing: 8) {
|
||||
Image(systemName: icon)
|
||||
Text(label)
|
||||
}
|
||||
.font(.tjScaled( 13, weight: .semibold))
|
||||
.foregroundStyle(enabled ? Tj.Palette.ink : Tj.Palette.text3)
|
||||
.font(.tjScaled( prominent ? 14 : 13, weight: .semibold))
|
||||
.foregroundStyle(prominent
|
||||
? (enabled ? Tj.Palette.paper : Tj.Palette.text3)
|
||||
: (enabled ? Tj.Palette.ink : Tj.Palette.text3))
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 11)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
.strokeBorder(
|
||||
enabled ? Tj.Palette.ink : Tj.Palette.line,
|
||||
style: StrokeStyle(lineWidth: 1, dash: enabled ? [] : [3, 3])
|
||||
)
|
||||
)
|
||||
.padding(.vertical, prominent ? 14 : 11)
|
||||
.background(assistButtonBackground(enabled: enabled, prominent: prominent))
|
||||
// 纯描边背景、内部透明:补 contentShape 让整框可点(否则只有图标+文字本体能点)。
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
@@ -300,6 +282,58 @@ struct DiaryQuickSheet: View {
|
||||
.disabled(!enabled)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func assistButtonBackground(enabled: Bool, prominent: Bool) -> some View {
|
||||
let shape = RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
if prominent {
|
||||
shape
|
||||
.fill(enabled ? Tj.Palette.brick : Tj.Palette.brickSoft)
|
||||
.shadow(color: enabled ? Tj.Palette.brick.opacity(0.30) : .clear,
|
||||
radius: 8, x: 0, y: 3)
|
||||
} else {
|
||||
shape
|
||||
.strokeBorder(
|
||||
enabled ? Tj.Palette.ink : Tj.Palette.line,
|
||||
style: StrokeStyle(lineWidth: 1, dash: enabled ? [] : [3, 3])
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// .loading 等待态:安静的 paper 卡片,底部一条细窄的不确定进度条来回滑动(Linear/Vercel 式极简)。
|
||||
/// 不用高亮扫光、不填强调色,避免刺眼;只靠细线 + sparkles 轻脉冲传达「在算」。
|
||||
private var assistLoadingIndicator: some View {
|
||||
HStack(spacing: 10) {
|
||||
Image(systemName: "sparkles")
|
||||
.font(.tjScaled( 12, weight: .semibold))
|
||||
.foregroundStyle(Tj.Palette.brick)
|
||||
.symbolEffect(.pulse, options: .repeating)
|
||||
Text(lastRate > 0
|
||||
? String(format: String(appLoc: "AI 生成中 · %.1f tok/s"), lastRate)
|
||||
: String(appLoc: "AI 生成中 · 本地推理"))
|
||||
.font(.tjScaled( 13, weight: .medium))
|
||||
.foregroundStyle(Tj.Palette.text2)
|
||||
Spacer(minLength: 0)
|
||||
Button("取消") { cancelSuggestions() }
|
||||
.font(.tjScaled( 12, weight: .semibold))
|
||||
.foregroundStyle(Tj.Palette.text3)
|
||||
}
|
||||
.padding(.vertical, 11)
|
||||
.padding(.horizontal, 12)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
.fill(Tj.Palette.paper)
|
||||
)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous)
|
||||
.strokeBorder(Tj.Palette.lineSoft, lineWidth: 1)
|
||||
)
|
||||
.overlay(alignment: .bottom) {
|
||||
AIFlowBar().padding(.horizontal, 1)
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: Tj.Radius.sm, style: .continuous))
|
||||
}
|
||||
|
||||
/// 给定整张 questions list 里 idx 位置的 question,返回它在自己 round 内的序号(1-based)。
|
||||
private func roundLocalIndex(at idx: Int) -> Int {
|
||||
let target = questions[idx].round
|
||||
|
||||
Reference in New Issue
Block a user