import 'package:get/get.dart'; import 'package:flutter/material.dart'; import '../../../data/providers/agent_provider.dart'; import '../../../routes/app_routes.dart'; class AIFeature { final String title; final String description; final IconData icon; final Color startColor; final Color endColor; final Color iconBgColor; final Color iconColor; final String agentId; final String targetRoute; AIFeature({ required this.title, required this.description, required this.icon, required this.startColor, required this.endColor, required this.iconBgColor, required this.iconColor, required this.agentId, required this.targetRoute, }); } class ExploreController extends GetxController { // AI功能列表 final List aiFeatures = [ AIFeature( title: 'aiAssistant'.tr, // AI全能助手 description: 'aiAssistantInfo'.tr, // 帮你解决各类问题 icon: Icons.assistant, startColor: const Color(0xFF0066CC), endColor: const Color(0xFF5E5CE6), iconBgColor: const Color(0xFF0066CC).withOpacity(0.2), iconColor: const Color(0xFF0066CC), agentId: 'personal_assistant', targetRoute: Routes.agent, ), AIFeature( title: 'interpretation'.tr, // 翻译 description: 'simultaneousInterpretationInfo'.tr, // 实时翻译80+种语言 icon: Icons.translate, startColor: const Color(0xFF4CAF50), endColor: const Color(0xFF009688), iconBgColor: const Color(0xFF4CAF50).withOpacity(0.2), iconColor: const Color(0xFF4CAF50), agentId: 'simultaneous_interpreter', targetRoute: Routes.translationMiddleware, ), AIFeature( title: 'conferenceAssistant'.tr, // 商务会议助手 description: 'conferenceAssistantInfo'.tr, // 实时记录会议纪要,多语言翻译 icon: Icons.people, startColor: const Color(0xFFab47bc), endColor: const Color(0xFFec407a), iconBgColor: const Color(0xFFd81b60).withOpacity(0.2), iconColor: const Color(0xFFd81b60), agentId: 'meeting_assistant', targetRoute: Routes.meeting, ), AIFeature( title: 'usageStats'.tr, // 用量统计 description: 'usageStatsInfo'.tr, // 查看您的使用统计数据 icon: Icons.analytics_outlined, startColor: const Color(0xFF2196F3), // 科技蓝 endColor: const Color(0xFF00BCD4), // 青蓝色 iconBgColor: const Color(0xFF2196F3).withOpacity(0.2), iconColor: const Color(0xFF2196F3), agentId: 'usage_stats', targetRoute: Routes.usageStats, ) ]; final List aiFeaturesWide = [ AIFeature( title: 'conferenceAssistant'.tr, // 商务会议助手 description: 'conferenceAssistantInfo'.tr, // 实时记录会议纪要,多语言翻译 icon: Icons.people, startColor: const Color(0xFFab47bc), endColor: const Color(0xFFec407a), iconBgColor: const Color(0xFFd81b60).withOpacity(0.2), iconColor: const Color(0xFFd81b60), agentId: 'meeting_assistant', targetRoute: Routes.meeting, ), ]; // 点击AI功能 void onAIFeatureTap(int index) { if (index < 0 || index >= aiFeatures.length) return; final feature = aiFeatures[index]; if (feature.targetRoute.isEmpty) return; // 根据目标路由进行跳转 Get.toNamed(feature.targetRoute); } // 点击AI功能(宽版本) void onAIFeatureWideTap(int index) { if (index < 0 || index >= aiFeaturesWide.length) return; final feature = aiFeaturesWide[index]; // 直接根据目标路由进行跳转 if (feature.targetRoute == Routes.meeting) { Get.toNamed(feature.targetRoute); } else if (feature.targetRoute == Routes.chat) { final agent = AgentProvider.getAgentById(feature.agentId); if (agent != null) { Get.toNamed(feature.targetRoute, arguments: { 'agentId': agent.id, 'agentName': agent.name, 'agentVoice': agent.voice, 'agentAvatar': agent.avatarUrl, 'agentSubtitle': agent.description, 'systemPrompt': agent.systemPrompt, 'welcomeMessage': agent.welcomeMessage, }); } } else if (feature.targetRoute.isNotEmpty) { Get.toNamed(feature.targetRoute); } } // 跳转到用量统计页面 void goToUsageStats() { Get.toNamed(Routes.usageStats); } }