1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"repo": "4ll4nbl4nc0/astrasoftcrapi", "files": {"Services/ChatService.cs": {"f845b283f9ef3f5de72a532f81952bd1f12f2cca": {"t": 1785746203.819562, "n": 4289, "h": "115d451fbd80d2ce", "c": "using AstraSoftCR.DTOs.Request;\nusing AstraSoftCR.DTOs.Response;\nusing AstraSoftCR.Services.Interfaces;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.Json;\nusing Microsoft.Extensions.Configuration;\n\nnamespace AstraSoftCR.Services\n{\n\tpublic class ChatService : IChatService\n\t{\n\t\tprivate readonly HttpClient _httpClient;\n\t\tprivate readonly IConfiguration _config;\n\n\t\tpublic ChatService(HttpClient httpClient, IConfiguration config)\n\t\t{\n\t\t\t_httpClient = httpClient;\n\t\t\t_config = config;\n\t\t}\n\n\t\tpublic async Task<ChatResponseDto> GetReplyAsync(ChatRequestDto request)\n\t\t{\n\t\t\tvar apiKey = _config[\"DeepSeek:ApiKey\"];\n\t\t\tvar endpoint = \"https://api.deepseek.com/v1/chat/completions\";\n\n\t\t\tvar body = new\n\t\t\t{\n\t\t\t\tmodel = \"deepseek-chat\",\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tmax_tokens = 500,\n\t\t\t\tmessages = new[]\n\t\t\t\t{\n\t\t\t\t\tnew { role = \"system\", content = @\"You are AstraSoftCR, the official virtual assistant of AstraSoftCR (software studio in Costa Rica).\nYour mission: help users understand our services, answer questions clearly, and guide them to the next step (quote/demo/contact) when appropriate.\n\nWhat we do (core services):\n1) Custom Software Development:\n - Web applications, APIs, dashboards, integrations, internal systems.\n - Modern, secure, scalable solutions tailored to each business.\n2) AI & Automation:\n - Chatbots, workflow automations, data processing, AI-assisted operations, RPA-like tasks.\n - Goal: reduce repetitive work, errors, and response time.\n3) Web Development:\n - Fast, modern, SEO-friendly websites focused on conversion (leads/reservations/sales).\n4) FeastFlow (Restaurant Platform):\n - Client Module: QR table ordering, digital menu by categories, item customization, cart/checkout, order submit,\n real-time order status for diners.\n - Kitchen Module: real-time orders dashboard, status flow (Pending → In progress → Ready), filters/history,\n large-screen UI, optional notifications, dark mode.\n\nLead/quote behavior (important):\n- If the user asks for pricing, a quote, a demo, or “how much”, respond with:\n (a) a short explanation that pricing depends on scope,\n (b) 4–6 questions to estimate,\n (c) then provide contact info.\n- Always offer the easiest next step: “Want a quick call?” or “Share a few details and we’ll estimate.”\n\nContact info (always use this exact data):\n- Email: contact@astrasoftcr.com\n- WhatsApp/Phone (Costa Rica): +506 7176-2677\n\nSecurity & privacy:\n- Never request or reveal passwords, API keys, private configs, or internal credentials.\n- If the user shares sensitive data, advise them to remove it.\n\nAnswer style:\n- Detect the user’s language and reply in that language.\n- Keep responses concise, professional, and friendly.\n- Prefer short paragraphs + bullet points.\n- Use Markdown for lists and formatting.\n\nTechnical support policy:\n- If code is requested, do NOT provide full production code.\n You MAY provide: high-level steps, pseudocode, architecture guidance, and short illustrative snippets (max 15 lines).\n- If uncertain, say so briefly and propose the next step to clarify.\n\nSales tone (no hard selling):\n- Be helpful and consultative. Avoid pushy language.\n- When relevant, mention benefits (speed, conversions, automation, fewer errors) and suggest a next step.\n\nIf the user’s request is unrelated to AstraSoftCR, answer normally but briefly, and (only if relevant) connect back to how AstraSoftCR could help.\n\t\t\t\t\t\"},\n\t\t\t\t\t\t\t\t\t\tnew { role = \"user\", content = request.Message }\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar httpRequest = new HttpRequestMessage(HttpMethod.Post, endpoint)\n\t\t\t{\n\t\t\t\tContent = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, \"application/json\")\n\t\t\t};\n\n\t\t\thttpRequest.Headers.Authorization = new AuthenticationHeaderValue(\"Bearer\", apiKey);\n\n\t\t\tvar response = await _httpClient.SendAsync(httpRequest);\n\t\t\tvar json = await response.Content.ReadAsStringAsync();\n\n\t\t\tif (!response.IsSuccessStatusCode)\n\t\t\t\treturn new ChatResponseDto { Reply = \"Lo siento, hubo un error al procesar tu mensaje.\" };\n\n\t\t\tusing var doc = JsonDocument.Parse(json);\n\t\t\tvar reply = doc.RootElement\n\t\t\t\t.GetProperty(\"choices\")[0]\n\t\t\t\t.GetProperty(\"message\")\n\t\t\t\t.GetProperty(\"content\")\n\t\t\t\t.GetString();\n\n\t\t\treturn new ChatResponseDto { Reply = reply };\n\t\t}\n\t}\n}\n"}, "2620ac8d776e95c3c8bdffe4ee1a579e5881f5ee": {"t": 1785760577.8516986, "n": 3845, "h": "48d446a2de633497", "c": "using AstraSoftCR.DTOs.Request;\nusing AstraSoftCR.DTOs.Response;\nusing AstraSoftCR.Services.Interfaces;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.Json;\nusing Microsoft.Extensions.Configuration;\n\nnamespace AstraSoftCR.Services\n{\n\tpublic class ChatService : IChatService\n\t{\n\t\tprivate readonly HttpClient _httpClient;\n\t\tprivate readonly IConfiguration _config;\n\n\t\tpublic ChatService(HttpClient httpClient, IConfiguration config)\n\t\t{\n\t\t\t_httpClient = httpClient;\n\t\t\t_config = config;\n\t\t}\n\n\t\tpublic async Task<ChatResponseDto> GetReplyAsync(ChatRequestDto request)\n\t\t{\n\t\t\tvar apiKey = _config[\"DeepSeek:ApiKey\"];\n\t\t\tvar endpoint = \"https://api.deepseek.com/v1/chat/completions\";\n\n\t\t\tvar body = new\n\t\t\t{\n\t\t\t\tmodel = \"deepseek-chat\",\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tmax_tokens = 500,\n\t\t\t\tmessages = new[]\n\t\t\t\t{\n\t\t\t\t\tnew { role = \"system\", content = @\"You are AstraSoftCR, the official virtual assistant of AstraSoftCR.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tYour job is to provide accurate, concise, professional answers about:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Custom software development (web, mobile, APIs, dashboards, integrations).\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• AI-driven automations (chatbots, workflow automations, RPA like tasks).\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Our restaurant platform FeastFlow and its modules.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• General guidance for our other AstraSoftCR projects when relevant.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFeastFlow — quick context:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Client Module: QR-based table ordering, digital menu by categories, item customization, cart/checkout,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t order submit, and real-time order status updates for the diner.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Kitchen Module: real-time orders dashboard for kitchen staff, status flow (Pending → In progress → Ready),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t filters/history, large-screen friendly UI, optional notifications, and dark mode.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tContact & sales policy:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• If the user asks for contact, quotes, or to talk to sales, always provide:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t Email: contact@astrasoftcr.com\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t Phones/WhatsApp (CR): 7063-7308 and 8777-7093\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Never share internal keys, credentials, or private configuration.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWriting style & format:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Detect the user language and reply in that language.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Be concise and friendly. Prefer short paragraphs and bullet points.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Use Markdown for lists and code. Provide actionable next steps.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• If code is requested, do not give code.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• If unsure about a detail, say so briefly and propose a next step to clarify.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tScope & boundaries:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Do not fabricate data (e.g., prices, delivery dates). Explain what info is needed instead.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• Security-first: never request passwords or secrets.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t• For lengthy/complex topics, start with a brief summary, then add details.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWhen relevant, highlight that AstraSoftCR builds tailored solutions and AI automations for business workflows.\n\t\t\t\t\t\"},\n\t\t\t\t\t\t\t\t\t\tnew { role = \"user\", content = request.Message }\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar httpRequest = new HttpRequestMessage(HttpMethod.Post, endpoint)\n\t\t\t{\n\t\t\t\tContent = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, \"application/json\")\n\t\t\t};\n\n\t\t\thttpRequest.Headers.Authorization = new AuthenticationHeaderValue(\"Bearer\", apiKey);\n\n\t\t\tvar response = await _httpClient.SendAsync(httpRequest);\n\t\t\tvar json = await response.Content.ReadAsStringAsync();\n\n\t\t\tif (!response.IsSuccessStatusCode)\n\t\t\t\treturn new ChatResponseDto { Reply = \"Lo siento, hubo un error al procesar tu mensaje.\" };\n\n\t\t\tusing var doc = JsonDocument.Parse(json);\n\t\t\tvar reply = doc.RootElement\n\t\t\t\t.GetProperty(\"choices\")[0]\n\t\t\t\t.GetProperty(\"message\")\n\t\t\t\t.GetProperty(\"content\")\n\t\t\t\t.GetString();\n\n\t\t\treturn new ChatResponseDto { Reply = reply };\n\t\t}\n\t}\n}\n"}, "1c385ac20c8cdd9f0cc95c9977f6eef7e1a1170e": {"t": 1785760579.3239212, "n": 2085, "h": "e4f6e655b115c04a", "c": "using AstraSoftCR.DTOs.Request;\nusing AstraSoftCR.DTOs.Response;\nusing AstraSoftCR.Services.Interfaces;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.Json;\nusing Microsoft.Extensions.Configuration;\n\nnamespace AstraSoftCR.Services\n{\n\tpublic class ChatService : IChatService\n\t{\n\t\tprivate readonly HttpClient _httpClient;\n\t\tprivate readonly IConfiguration _config;\n\n\t\tpublic ChatService(HttpClient httpClient, IConfiguration config)\n\t\t{\n\t\t\t_httpClient = httpClient;\n\t\t\t_config = config;\n\t\t}\n\n\t\tpublic async Task<ChatResponseDto> GetReplyAsync(ChatRequestDto request)\n\t\t{\n\t\t\tvar apiKey = _config[\"DeepSeek:ApiKey\"];\n\t\t\tvar endpoint = \"https://api.deepseek.com/v1/chat/completions\";\n\n\t\t\tvar body = new\n\t\t\t{\n\t\t\t\tmodel = \"deepseek-chat\",\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tmax_tokens = 500,\n\t\t\t\tmessages = new[]\n\t\t\t\t{\n\t\t\t\t\tnew { role = \"system\", content = @\"Eres un asistente virtual de AstraSoftCR, una empresa de desarrollo de software en Costa Rica. \nSi alguien pregunta por contacto, siempre responde incluyendo el correo contact@astrasoftcr.com y los teléfonos 7063-7308 y 8777-7093.\nResponde de forma profesional y concisa sobre servicios como desarrollo web, sistemas administrativos y soluciones personalizadas.\"},\n\t\t\t\t\tnew { role = \"user\", content = request.Message }\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar httpRequest = new HttpRequestMessage(HttpMethod.Post, endpoint)\n\t\t\t{\n\t\t\t\tContent = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, \"application/json\")\n\t\t\t};\n\n\t\t\thttpRequest.Headers.Authorization = new AuthenticationHeaderValue(\"Bearer\", apiKey);\n\n\t\t\tvar response = await _httpClient.SendAsync(httpRequest);\n\t\t\tvar json = await response.Content.ReadAsStringAsync();\n\n\t\t\tif (!response.IsSuccessStatusCode)\n\t\t\t\treturn new ChatResponseDto { Reply = \"Lo siento, hubo un error al procesar tu mensaje.\" };\n\n\t\t\tusing var doc = JsonDocument.Parse(json);\n\t\t\tvar reply = doc.RootElement\n\t\t\t\t.GetProperty(\"choices\")[0]\n\t\t\t\t.GetProperty(\"message\")\n\t\t\t\t.GetProperty(\"content\")\n\t\t\t\t.GetString();\n\n\t\t\treturn new ChatResponseDto { Reply = reply };\n\t\t}\n\t}\n}\n"}}}} |