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:
@@ -1,61 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../providers/chat_provider.dart';
|
||||
|
||||
/// 智能体胶囊栏——横向滑动
|
||||
class AgentBar extends ConsumerWidget {
|
||||
const AgentBar({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final selected = ref.watch(selectedAgentProvider);
|
||||
final chatNotifier = ref.read(chatProvider.notifier);
|
||||
|
||||
void onTap(ActiveAgent agent) {
|
||||
final notifier = ref.read(selectedAgentProvider.notifier);
|
||||
notifier.select(agent == selected ? null : agent);
|
||||
chatNotifier.setAgent(agent);
|
||||
}
|
||||
|
||||
return Container(
|
||||
height: 48,
|
||||
color: Colors.white,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
children: [
|
||||
_buildCapsule('AI问诊', Icons.medical_services, ActiveAgent.consultation, selected, onTap),
|
||||
_buildCapsule('记数据', Icons.edit_note, ActiveAgent.health, selected, onTap),
|
||||
_buildCapsule('拍饮食', Icons.restaurant, ActiveAgent.diet, selected, onTap),
|
||||
_buildCapsule('药管家', Icons.medication, ActiveAgent.medication, selected, onTap),
|
||||
_buildCapsule('看报告', Icons.description, ActiveAgent.report, selected, onTap),
|
||||
_buildCapsule('运动计划', Icons.fitness_center, ActiveAgent.exercise, selected, onTap),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCapsule(String label, IconData icon, ActiveAgent agent, ActiveAgent? selected, void Function(ActiveAgent) onTap) {
|
||||
final isSelected = selected == agent;
|
||||
return GestureDetector(
|
||||
onTap: () => onTap(agent),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? const Color(0xFF8B9CF7) : Colors.white,
|
||||
border: Border.all(color: const Color(0xFF8B9CF7)),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(icon, size: 16, color: isSelected ? Colors.white : const Color(0xFF8B9CF7)),
|
||||
const SizedBox(width: 6),
|
||||
Text(label, style: TextStyle(fontSize: 13, color: isSelected ? Colors.white : const Color(0xFF8B9CF7))),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user