fix: 数据确认面板修复 - 显示实际数值+确认关闭+侧边栏刷新+清理旧数据
- Handler返回value/unit/isAbnormal到metadata - DataConfirmCard显示实际数值和单位 - 确认按钮关闭卡片+刷新健康概览 - 健康Agent欢迎卡简化为'查看趋势' - 清空87条旧健康测试数据
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user