refactor: 4层架构重构 + 饮食VLM接入 + 多项修复

- 后端: 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份实施文档(情况/问诊/报告/建档/日历/视觉统一)
This commit is contained in:
MingNian
2026-06-03 23:17:37 +08:00
parent 5bd0155e17
commit c2399b952f
33 changed files with 3311 additions and 660 deletions

View File

@@ -3,14 +3,13 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:health_app/core/app_theme.dart';
import 'package:health_app/pages/auth/login_page.dart';
import 'package:health_app/widgets/agent_bar.dart';
void main() {
testWidgets('主题颜色正确', (tester) async {
expect(AppTheme.primaryColor, const Color(0xFF635BFF));
expect(AppTheme.background, const Color(0xFFF8F9FF));
expect(AppTheme.errorRed, const Color(0xFFE53935));
expect(AppTheme.successGreen, const Color(0xFF43A047));
expect(AppTheme.primary, const Color(0xFF8B9CF7));
expect(AppTheme.bg, const Color(0xFFF8F9FC));
expect(AppTheme.error, const Color(0xFFF56C6C));
expect(AppTheme.success, const Color(0xFF6ECF8A));
});
testWidgets('登录页渲染正常', (tester) async {
@@ -28,18 +27,6 @@ void main() {
expect(find.text('获取验证码'), findsOneWidget);
});
testWidgets('智能体胶囊栏渲染 6 个胶囊', (tester) async {
await tester.pumpWidget(const ProviderScope(child: MaterialApp(home: Scaffold(body: AgentBar()))));
await tester.pumpAndSettle();
expect(find.text('AI问诊'), findsOneWidget);
expect(find.text('记数据'), findsOneWidget);
expect(find.text('拍饮食'), findsOneWidget);
expect(find.text('药管家'), findsOneWidget);
expect(find.text('看报告'), findsOneWidget);
expect(find.text('运动计划'), findsOneWidget);
});
testWidgets('AI 气泡样式', (tester) async {
await tester.pumpWidget(MaterialApp(
theme: AppTheme.lightTheme,
@@ -51,7 +38,7 @@ void main() {
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
border: const Border(left: BorderSide(color: Color(0xFF635BFF), width: 3)),
border: const Border(left: BorderSide(color: Color(0xFF8B9CF7), width: 3)),
),
child: const Text('收到!已记录', style: TextStyle(fontSize: 16)),
),
@@ -70,7 +57,7 @@ void main() {
constraints: const BoxConstraints(maxWidth: 300),
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: const Color(0xFF635BFF),
color: const Color(0xFF8B9CF7),
borderRadius: BorderRadius.circular(16),
),
child: const Text('血压 135/85', style: TextStyle(fontSize: 16, color: Colors.white)),