From c2399b952fac76310ac63a9f241610a201dcb668 Mon Sep 17 00:00:00 2001
From: MingNian <1281442923@qq.com>
Date: Wed, 3 Jun 2026 23:17:37 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=204=E5=B1=82=E6=9E=B6=E6=9E=84?=
=?UTF-8?q?=E9=87=8D=E6=9E=84=20+=20=E9=A5=AE=E9=A3=9FVLM=E6=8E=A5?=
=?UTF-8?q?=E5=85=A5=20+=20=E5=A4=9A=E9=A1=B9=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 后端: remaining_endpoints拆分为6个独立文件
- 后端: AI Agent Handler从ai_chat_endpoints抽取为7个独立处理器
- 后端: 食物识别prompt改为输出结构化JSON
- 前端: 饮食识别从Mock替换为真实VLM API调用
- 前端: 首页图片上传URL修复(/api/upload→/api/files/upload)
- 前端: 拍饮食按钮导航到独立DietCapturePage
- 前端: 删除无用agent_bar.dart
- 前端: 修复widget_test.dart过期属性名
- 前端: 恢复ServicePackageCard和详情页
- 新增6份实施文档(情况/问诊/报告/建档/日历/视觉统一)
---
.../AI/AgentHandlers/common_agent_handler.cs | 64 +++
.../consultation_agent_handler.cs | 27 ++
.../AI/AgentHandlers/diet_agent_handler.cs | 23 +
.../AgentHandlers/exercise_agent_handler.cs | 70 +++
.../health_data_agent_handler.cs | 79 +++
.../AgentHandlers/medication_agent_handler.cs | 73 +++
.../AI/AgentHandlers/report_agent_handler.cs | 23 +
.../src/Health.Infrastructure/GlobalUsings.cs | 2 +
.../Endpoints/ai_chat_endpoints.cs | 278 ++---------
.../Endpoints/consultation_endpoints.cs | 70 +++
.../Health.WebApi/Endpoints/diet_endpoints.cs | 49 ++
.../Endpoints/exercise_endpoints.cs | 69 +++
.../Health.WebApi/Endpoints/file_endpoints.cs | 30 ++
.../Endpoints/medication_endpoints.cs | 91 ++++
.../Endpoints/remaining_endpoints.cs | 310 ------------
.../Endpoints/report_endpoints.cs | 26 +
backend/tests/Health.Tests/unit_test1.cs | 10 -
health_app/lib/core/app_router.dart | 3 +
.../lib/pages/diet/diet_capture_page.dart | 91 +++-
.../home/widgets/chat_messages_view.dart | 4 +-
.../lib/pages/profile/profile_page.dart | 6 +
.../profile/service_package_detail_page.dart | 125 +++++
health_app/lib/providers/chat_provider.dart | 2 +-
health_app/lib/widgets/agent_bar.dart | 61 ---
health_app/lib/widgets/health_drawer.dart | 6 +
.../lib/widgets/service_package_card.dart | 337 +++++++++++++
health_app/test/widget_test.dart | 25 +-
健康管家-报告模块实施文档.md | 356 ++++++++++++++
健康管家-日历页实施文档.md | 252 ++++++++++
健康管家-视觉统一实施文档.md | 292 +++++++++++
健康管家-问诊对话页实施文档.md | 456 ++++++++++++++++++
健康管家-首次建档引导实施文档.md | 329 +++++++++++++
情况.md | 332 +++++++++++++
33 files changed, 3311 insertions(+), 660 deletions(-)
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/common_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/consultation_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/diet_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/exercise_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/health_data_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/medication_agent_handler.cs
create mode 100644 backend/src/Health.Infrastructure/AI/AgentHandlers/report_agent_handler.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/consultation_endpoints.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/diet_endpoints.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/exercise_endpoints.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/file_endpoints.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/medication_endpoints.cs
delete mode 100644 backend/src/Health.WebApi/Endpoints/remaining_endpoints.cs
create mode 100644 backend/src/Health.WebApi/Endpoints/report_endpoints.cs
delete mode 100644 backend/tests/Health.Tests/unit_test1.cs
create mode 100644 health_app/lib/pages/profile/service_package_detail_page.dart
delete mode 100644 health_app/lib/widgets/agent_bar.dart
create mode 100644 health_app/lib/widgets/service_package_card.dart
create mode 100644 健康管家-报告模块实施文档.md
create mode 100644 健康管家-日历页实施文档.md
create mode 100644 健康管家-视觉统一实施文档.md
create mode 100644 健康管家-问诊对话页实施文档.md
create mode 100644 健康管家-首次建档引导实施文档.md
create mode 100644 情况.md
diff --git a/backend/src/Health.Infrastructure/AI/AgentHandlers/common_agent_handler.cs b/backend/src/Health.Infrastructure/AI/AgentHandlers/common_agent_handler.cs
new file mode 100644
index 0000000..e461ff7
--- /dev/null
+++ b/backend/src/Health.Infrastructure/AI/AgentHandlers/common_agent_handler.cs
@@ -0,0 +1,64 @@
+namespace Health.Infrastructure.AI.AgentHandlers;
+
+///
+/// 共享工具处理器——被多个 Agent 引用的通用工具
+///
+public static class CommonAgentHandler
+{
+ public static readonly ToolDefinition QueryHealthRecordsTool = new()
+ {
+ Function = new()
+ {
+ Name = "query_health_records", Description = "查询近期健康数据",
+ Parameters = new { type = "object", properties = new { type = new { type = "string" }, days = new { type = "integer" } } }
+ }
+ };
+
+ public static readonly ToolDefinition CheckArchiveTool = new()
+ {
+ Function = new() { Name = "check_archive", Description = "查询患者健康档案", Parameters = new { type = "object", properties = new { } } }
+ };
+
+ public static List Tools => [QueryHealthRecordsTool, CheckArchiveTool];
+
+ public static async Task