{"repo": "atieng/famai", "files": {"lib/services/ai_service.dart": {"5745b9bc0736b989a76fbb1ea78e9ad0cc9ffc0a": {"t": 1785746393.9926713, "n": 1906, "h": "d6c071088800cd28", "c": "import 'dart:convert';\nimport 'package:http/http.dart' as http;\n\nclass AIService {\n static const String _apiKey = 'sk-3d0d0177448043fd9835122d634cc5d3';\n static const String _baseUrl = 'https://api.deepseek.com/v1/chat/completions';\n\n Future sendMessage(String message) async {\n try {\n final response = await http.post(\n Uri.parse(_baseUrl),\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer $_apiKey',\n },\n body: jsonEncode({\n 'model': 'deepseek-chat',\n 'messages': [\n {\n 'role': 'system',\n 'content': 'You are a helpful agricultural assistant. Provide accurate, practical advice about farming, plant diseases, crop management, and sustainable agriculture. Be concise but thorough.'\n },\n {\n 'role': 'user',\n 'content': message\n }\n ],\n 'max_tokens': 1000,\n 'temperature': 0.7,\n }),\n );\n\n if (response.statusCode == 200) {\n final data = jsonDecode(response.body);\n return data['choices'][0]['message']['content'] ?? 'Sorry, I could not process that.';\n } else {\n return 'Error: API request failed with status ${response.statusCode}';\n }\n } catch (e) {\n return 'Error: ${e.toString()}';\n }\n }\n\n Future getAgriculturalAdvice(String topic) async {\n final prompt = 'As an agricultural expert, provide detailed advice about: $topic. Include practical steps, best practices, and considerations for farmers.';\n return sendMessage(prompt);\n }\n\n Future analyzePlantProblem(String description) async {\n final prompt = 'Analyze this plant problem and provide solutions: $description. Include possible causes, symptoms to look for, and recommended treatments.';\n return sendMessage(prompt);\n }\n}\n"}, "341d77da2a2072666ba9bf4a94beb1b98ed2512c": {"t": 1785763235.8857508, "n": 1906, "h": "d6c071088800cd28", "c": "import 'dart:convert';\nimport 'package:http/http.dart' as http;\n\nclass AIService {\n static const String _apiKey = 'sk-3d0d0177448043fd9835122d634cc5d3';\n static const String _baseUrl = 'https://api.deepseek.com/v1/chat/completions';\n\n Future sendMessage(String message) async {\n try {\n final response = await http.post(\n Uri.parse(_baseUrl),\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': 'Bearer $_apiKey',\n },\n body: jsonEncode({\n 'model': 'deepseek-chat',\n 'messages': [\n {\n 'role': 'system',\n 'content': 'You are a helpful agricultural assistant. Provide accurate, practical advice about farming, plant diseases, crop management, and sustainable agriculture. Be concise but thorough.'\n },\n {\n 'role': 'user',\n 'content': message\n }\n ],\n 'max_tokens': 1000,\n 'temperature': 0.7,\n }),\n );\n\n if (response.statusCode == 200) {\n final data = jsonDecode(response.body);\n return data['choices'][0]['message']['content'] ?? 'Sorry, I could not process that.';\n } else {\n return 'Error: API request failed with status ${response.statusCode}';\n }\n } catch (e) {\n return 'Error: ${e.toString()}';\n }\n }\n\n Future getAgriculturalAdvice(String topic) async {\n final prompt = 'As an agricultural expert, provide detailed advice about: $topic. Include practical steps, best practices, and considerations for farmers.';\n return sendMessage(prompt);\n }\n\n Future analyzePlantProblem(String description) async {\n final prompt = 'Analyze this plant problem and provide solutions: $description. Include possible causes, symptoms to look for, and recommended treatments.';\n return sendMessage(prompt);\n }\n}\n"}, "94d2cba4bff1d5d61878e4cd54f11603249ee1d6": {"t": 1785763237.2196624, "n": 553, "h": "f24a3008a913afdb", "c": "import 'package:google_generative_ai/google_generative_ai.dart';\nimport 'package:famai/utils/secrets.dart';\n\nclass AIService {\n final GenerativeModel _model;\n\n AIService() : _model = GenerativeModel(model: 'gemini-pro', apiKey: geminiApiKey);\n\n Future sendMessage(String message) async {\n try {\n final content = [Content.text(message)];\n final response = await _model.generateContent(content);\n return response.text ?? 'Sorry, I could not process that.';\n } catch (e) {\n return 'Error: ${e.toString()}';\n }\n }\n}\n"}}}}