fix: 数据确认面板修复 - 显示实际数值+确认关闭+侧边栏刷新+清理旧数据

- Handler返回value/unit/isAbnormal到metadata
- DataConfirmCard显示实际数值和单位
- 确认按钮关闭卡片+刷新健康概览
- 健康Agent欢迎卡简化为'查看趋势'
- 清空87条旧健康测试数据
This commit is contained in:
MingNian
2026-06-04 21:57:02 +08:00
parent cd65bc4d65
commit 20a5ce1199
4 changed files with 69 additions and 161 deletions

View File

@@ -74,6 +74,11 @@ public static class HealthDataAgentHandler
db.HealthRecords.Add(record);
await db.SaveChangesAsync();
return new { success = true, record_id = record.Id, type = record.MetricType.ToString() };
var valStr = record.MetricType switch
{
HealthMetricType.BloodPressure => $"{record.Systolic}/{record.Diastolic}",
_ => record.Value?.ToString() ?? ""
};
return new { success = true, record_id = record.Id, type = record.MetricType.ToString(), value = valStr, unit = record.Unit, isAbnormal = record.IsAbnormal };
}
}

View File

@@ -408,8 +408,10 @@ public static class AiChatEndpoints
messageType = "data_confirm";
if (toolResult is IDictionary<string, object> resultDict)
{
if (resultDict.TryGetValue("type", out var type))
metadata["type"] = type.ToString();
if (resultDict.TryGetValue("type", out var type)) metadata["type"] = type.ToString();
if (resultDict.TryGetValue("value", out var val)) metadata["value"] = val.ToString();
if (resultDict.TryGetValue("unit", out var unit)) metadata["unit"] = unit.ToString();
if (resultDict.TryGetValue("isAbnormal", out var abn) && abn is bool b2) metadata["abnormal"] = b2;
if (resultDict.TryGetValue("success", out var success) && success is bool b && b)
metadata["success"] = true;
}