Files

1 line
7.1 KiB
JSON

{"repo": "arthurbalaji/accessmate", "files": {"backend/.env": {"bf98daaebe99c650d70dbddd1e6a1c42cdb5af27": {"t": 1785745087.6557949, "n": 573, "h": "cc08bbe1e531664f", "c": "# AccessMate Voice Backend Environment Variables\n\n# Server Configuration\nPORT=5000\nNODE_ENV=development\n\n# API Keys\nDEEPSEEK_API_KEY=sk-13ff13885d4c493d8d4ea47ad9e5a6a8\nGOOGLE_API_KEY=AIzaSyDEQU6cmh9OggRvac0CFYN5LU7V93zyC7k\nGOOGLE_SEARCH_ENGINE_ID=f58e2bb572bde4b33\n\n# Database Configuration (if you want to add a database later)\n# DB_HOST=localhost\n# DB_PORT=5432\n# DB_NAME=accessmate\n# DB_USER=postgres\n# DB_PASSWORD=password\n\n# CORS Origins\nCORS_ORIGINS=http://localhost:3000,http://localhost:3001\n\n# Rate Limiting\nRATE_LIMIT_WINDOW_MS=900000\nRATE_LIMIT_MAX_REQUESTS=100"}}, "BackendService/server/routes/ai-processor.js": {"bf98daaebe99c650d70dbddd1e6a1c42cdb5af27": {"t": 1785745530.6344163, "n": 5235, "h": "9c0abcf4af001934", "c": "const express = require('express');\nconst axios = require('axios');\nconst router = express.Router();\n\n/**\n * AI Processor endpoint\n * Handles DeepSeek AI API requests for content processing\n */\nrouter.post('/', async (req, res) => {\n try {\n console.log('AI Processor request body:', JSON.stringify(req.body, null, 2));\n \n const { action, content, context = '', options = {} } = req.body;\n\n if (!action) {\n return res.status(400).json({\n success: false,\n error: 'Action parameter is required'\n });\n }\n\n if (!content || content.trim() === '') {\n return res.status(400).json({\n success: false,\n error: 'Content parameter is required and cannot be empty'\n });\n }\n\n const API_KEY = process.env.DEEPSEEK_API_KEY;\n if (!API_KEY) {\n return res.status(500).json({\n success: false,\n error: 'DeepSeek API key not configured'\n });\n }\n\n let prompt = '';\n let maxTokens = 500;\n\n switch (action) {\n case 'summarize':\n prompt = `Please provide a concise, accessible summary of the following content for users with visual impairments. Focus on key information and structure it clearly:\\n\\nContent: ${content}`;\n maxTokens = 300;\n break;\n\n case 'simplify':\n prompt = `Please rewrite the following content in simple, clear language that is easy to understand for users with cognitive disabilities. Use shorter sentences and common words:\\n\\nContent: ${content}`;\n maxTokens = 400;\n break;\n\n case 'extract_keywords':\n prompt = `Extract the most important keywords and key phrases from the following content. List them separated by commas:\\n\\nContent: ${content}`;\n maxTokens = 100;\n break;\n\n case 'describe_structure':\n prompt = `Analyze and describe the structure and layout of this webpage content for a user who cannot see it. Include information about headings, sections, lists, and navigation elements:\\n\\nContent: ${content}`;\n maxTokens = 400;\n break;\n\n case 'answer_question':\n if (!context) {\n return res.status(400).json({\n success: false,\n error: 'Context is required for question answering'\n });\n }\n prompt = `Based on the following content, please answer this question: \"${context}\"\\n\\nContent: ${content}`;\n maxTokens = 300;\n break;\n\n case 'accessibility_check':\n prompt = `Analyze the following webpage content for accessibility issues and provide recommendations for improvement:\\n\\nContent: ${content}`;\n maxTokens = 400;\n break;\n\n default:\n return res.status(400).json({\n success: false,\n error: 'Invalid action. Supported actions: summarize, simplify, extract_keywords, describe_structure, answer_question, accessibility_check'\n });\n }\n\n console.log('AI Processor: Processing request:', { \n action, \n contentLength: content.length,\n contentPreview: content.substring(0, 100) + '...'\n });\n\n // Make request to DeepSeek API\n const aiResponse = await axios.post('https://api.deepseek.com/v1/chat/completions', {\n model: 'deepseek-chat',\n messages: [\n {\n role: 'system',\n content: 'You are an AI assistant specialized in web accessibility and helping users with disabilities navigate and understand web content. Provide clear, concise, and helpful responses.'\n },\n {\n role: 'user',\n content: prompt\n }\n ],\n max_tokens: maxTokens,\n temperature: 0.7,\n top_p: 1,\n frequency_penalty: 0,\n presence_penalty: 0\n }, {\n headers: {\n 'Authorization': `Bearer ${API_KEY}`,\n 'Content-Type': 'application/json'\n },\n timeout: 30000\n });\n\n const aiResult = aiResponse.data.choices[0]?.message?.content;\n\n if (!aiResult) {\n return res.status(500).json({\n success: false,\n error: 'No response from AI service'\n });\n }\n\n const result = {\n action: action,\n result: aiResult.trim(),\n originalContentLength: content.length,\n processedAt: new Date().toISOString(),\n tokenUsage: aiResponse.data.usage || {}\n };\n\n console.log('AI Processor: Successfully processed request:', {\n action,\n resultLength: result.result.length,\n tokenUsage: result.tokenUsage\n });\n\n res.json({\n success: true,\n data: result\n });\n\n } catch (error) {\n console.error('AI Processor Error:', error.message);\n \n if (error.response) {\n console.error('AI API Response Error:', error.response.data);\n return res.status(error.response.status).json({\n success: false,\n error: 'AI processing failed',\n details: error.response.data\n });\n }\n\n res.status(500).json({\n success: false,\n error: 'AI processing request failed',\n message: error.message\n });\n }\n});\n\n// Health check for AI service\nrouter.get('/health', (req, res) => {\n res.json({\n success: true,\n service: 'AI Processor',\n status: 'running',\n apiKeyConfigured: !!process.env.DEEPSEEK_API_KEY\n });\n});\n\nmodule.exports = router;"}}, "BackendService/app-config.json": {"bf98daaebe99c650d70dbddd1e6a1c42cdb5af27": {"t": 1785746784.1084979, "n": 649, "h": "c89f2b7b406c7501", "c": "{\n\t\"command\": \"node server.js\",\n\t\"build_path\": \"D:\\\\AccessMate\\\\BackendService\\\\build\",\n\t\"stack\": \"node18\",\n\t\"env_variables\": {\n\t\t\"NODE_ENV\": \"production\",\n\t\t\"DEEPSEEK_API_KEY\": \"sk-7f13ed7b48484ed7950e0f44a1fb1aee\"\n\t},\n\t\"memory\": 512,\n\t\"scripts\": {\n\t\t\"preserve\": \"node ./scripts/filesHelper.js -c ./server/ ./build/ && cd build && npm install --no-package-lock --loglevel=error\",\n\t\t\"postserve\": \"node ./scripts/filesHelper.js -d ./build\",\n\t\t\"predeploy\": \"node ./scripts/filesHelper.js -c ./server/ ./build/ && cd build && npm install --production --no-package-lock --loglevel=error\",\n\t\t\"postdeploy\": \"node ./scripts/filesHelper.js -d ./build\"\n\t}\n}\n"}}}}