Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/ayom04_mediguard-api.json
T

1 line
4.6 KiB
JSON

{"repo": "ayom04/mediguard-api", "files": {"services/syptomchecker.js": {"366b1ca75bf1244e24bfdf4466d70151feec6aef": {"t": 1785746706.00936, "n": 2120, "h": "8cdb002800962a8b", "c": "const { OpenAI } = require(\"openai\");\n\n// Initialize OpenAI with DeepSeek configuration\nconst openai = new OpenAI({\n apiKey: process.env.DEEPSEEK_API_KEY,\n // base_url: \"https://api.deepseek.com\",\n});\n\n/**\n * Analyzes user symptoms and provides potential health insights\n * @param {string} symptoms - User's described symptoms\n * @returns {Promise<string>} Analysis response\n */\nconst analyzeSymptoms = async (symptoms) => {\n const systemPrompt = `You are a symptom analysis assistant. Analyze symptoms, list common conditions, rate urgency (Non-urgent, Semi-urgent, Urgent), give recommendations, and include a disclaimer. Start with the disclaimer and end with a consultation note.`;\n\n const userPrompt = `Analyze these symptoms: ${symptoms}. Use this format:\n ---\n MEDICAL DISCLAIMER: Not medical advice—consult a healthcare professional.\n \n SYMPTOM ANALYSIS:\n [List and analyze symptoms]\n \n POSSIBLE CONDITIONS:\n [List common conditions]\n \n URGENCY:\n [Non-urgent, Semi-urgent, or Urgent, with explanation]\n \n RECOMMENDATIONS:\n [Basic suggestions]\n \n IMPORTANT: See a healthcare professional. Seek immediate help if severe.\n ---`;\n try {\n const completion = await openai.chat.completions.create({\n model: \"gpt-4o\",\n store: true,\n messages: [\n { role: \"system\", content: systemPrompt },\n { role: \"user\", content: userPrompt },\n ],\n temperature: 0.7, // Balanced between creativity and consistency\n max_tokens: 1000, // Adjust based on needed response length\n });\n\n return completion.choices[0].message.content;\n } catch (error) {\n console.error(\"Error analyzing symptoms:\", error);\n return \"Error analyzing symptoms. Please try again or consult a healthcare professional directly.\";\n }\n};\n\n// Example usage:\n/*\nconst symptoms = \"I've been experiencing a throbbing headache for the past 2 days, \" +\n \"along with mild fever and fatigue. The pain is worse in the morning.\";\n\nanalyzeSymptoms(symptoms)\n .then(analysis => console.log(analysis))\n .catch(error => console.error(error));\n*/\n\nmodule.exports = analyzeSymptoms;\n"}, "cd4aa16b4d6a362bd6851b188c55a46224aec136": {"t": 1785767118.1090822, "n": 2120, "h": "8cdb002800962a8b", "c": "const { OpenAI } = require(\"openai\");\n\n// Initialize OpenAI with DeepSeek configuration\nconst openai = new OpenAI({\n apiKey: process.env.DEEPSEEK_API_KEY,\n // base_url: \"https://api.deepseek.com\",\n});\n\n/**\n * Analyzes user symptoms and provides potential health insights\n * @param {string} symptoms - User's described symptoms\n * @returns {Promise<string>} Analysis response\n */\nconst analyzeSymptoms = async (symptoms) => {\n const systemPrompt = `You are a symptom analysis assistant. Analyze symptoms, list common conditions, rate urgency (Non-urgent, Semi-urgent, Urgent), give recommendations, and include a disclaimer. Start with the disclaimer and end with a consultation note.`;\n\n const userPrompt = `Analyze these symptoms: ${symptoms}. Use this format:\n ---\n MEDICAL DISCLAIMER: Not medical advice—consult a healthcare professional.\n \n SYMPTOM ANALYSIS:\n [List and analyze symptoms]\n \n POSSIBLE CONDITIONS:\n [List common conditions]\n \n URGENCY:\n [Non-urgent, Semi-urgent, or Urgent, with explanation]\n \n RECOMMENDATIONS:\n [Basic suggestions]\n \n IMPORTANT: See a healthcare professional. Seek immediate help if severe.\n ---`;\n try {\n const completion = await openai.chat.completions.create({\n model: \"gpt-4o\",\n store: true,\n messages: [\n { role: \"system\", content: systemPrompt },\n { role: \"user\", content: userPrompt },\n ],\n temperature: 0.7, // Balanced between creativity and consistency\n max_tokens: 1000, // Adjust based on needed response length\n });\n\n return completion.choices[0].message.content;\n } catch (error) {\n console.error(\"Error analyzing symptoms:\", error);\n return \"Error analyzing symptoms. Please try again or consult a healthcare professional directly.\";\n }\n};\n\n// Example usage:\n/*\nconst symptoms = \"I've been experiencing a throbbing headache for the past 2 days, \" +\n \"along with mild fever and fatigue. The pain is worse in the morning.\";\n\nanalyzeSymptoms(symptoms)\n .then(analysis => console.log(analysis))\n .catch(error => console.error(error));\n*/\n\nmodule.exports = analyzeSymptoms;\n"}}}}