Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/anwar-alhitar_deepseek.asp.client.json

1 line
5.2 KiB
JSON
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "anwar-alhitar/deepseek.asp.client", "files": {"Deepseek.AspClient/Client/DeepseekClient.cs": {"c571895c1d7ca2e979be1d50389a883466e64286": {"t": 1785746186.8144102, "n": 2406, "h": "bc81ea057943f267", "c": "using Deepseek.AspClient.Exceptions;\nusing Deepseek.AspClient.Models.Request;\nusing Deepseek.AspClient.Models.Response;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Text;\nusing System.Text.Json;\nusing System.Threading.Tasks;\n\nnamespace Deepseek.AspClient.Client\n{\n public class DeepseekClient : IDeepseekClient\n {\n private readonly HttpClient _httpClient;\n private readonly JsonSerializerOptions _jsonOptions;\n\n public DeepseekClient(string apiKey, string baseUrl = \"https://api.deepseek.com/v1/\")\n {\n _httpClient = new HttpClient\n {\n BaseAddress = new Uri(baseUrl)\n };\n _httpClient.DefaultRequestHeaders.Add(\"Authorization\", $\"Bearer {apiKey}\");\n\n _jsonOptions = new JsonSerializerOptions\n {\n PropertyNamingPolicy = JsonNamingPolicy.CamelCase,\n WriteIndented = true\n };\n }\n\n public async Task<DeepseekResponse> GenerateResponseAsync(DeepseekRequest request)\n {\n try\n {\n var content = new StringContent(\n JsonSerializer.Serialize(request, _jsonOptions),\n Encoding.UTF8,\n \"application/json\");\n\n var response = await _httpClient.PostAsync(\"chat/completions\", content);\n var responseContent = await response.Content.ReadAsStringAsync();\n\n if (!response.IsSuccessStatusCode)\n {\n var error = JsonSerializer.Deserialize<ApiError>(responseContent, _jsonOptions);\n throw new DeepseekException(\n $\"API Error: {error?.Message ?? \"Unknown error\"}\",\n response.StatusCode);\n }\n\n return JsonSerializer.Deserialize<DeepseekResponse>(responseContent, _jsonOptions);\n }\n catch (Exception ex)\n {\n throw new DeepseekException(\"Request failed\", HttpStatusCode.InternalServerError, ex);\n }\n }\n\n public async Task<DeepseekResponse> GenerateResponseAsync(string prompt)\n {\n return await GenerateResponseAsync(new DeepseekRequest\n {\n Messages = [new Message { Content = prompt }]\n });\n }\n }\n}\n"}, "9b5361f0ee44313bdf5c798dd4a64331991fa8be": {"t": 1785760443.0929441, "n": 2426, "h": "e99d22c9b15e4500", "c": "using Deepseek.AspClient.Exceptions;\nusing Deepseek.AspClient.Models.Request;\nusing Deepseek.AspClient.Models.Response;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Text;\nusing System.Text.Json;\nusing System.Threading.Tasks;\n\nnamespace Deepseek.AspClient.Client\n{\n public class DeepseekClient : IDeepseekClient\n {\n private readonly HttpClient _httpClient;\n private readonly JsonSerializerOptions _jsonOptions;\n\n public DeepseekClient(string apiKey, string baseUrl = \"https://api.deepseek.com/v1/\")\n {\n _httpClient = new HttpClient\n {\n BaseAddress = new Uri(baseUrl)\n };\n _httpClient.DefaultRequestHeaders.Add(\"Authorization\", $\"Bearer {apiKey}\");\n\n _jsonOptions = new JsonSerializerOptions\n {\n PropertyNamingPolicy = JsonNamingPolicy.CamelCase,\n WriteIndented = true\n };\n }\n\n public async Task<DeepseekResponse> GenerateResponseAsync(DeepseekRequest request)\n {\n try\n {\n var content = new StringContent(\n JsonSerializer.Serialize(request, _jsonOptions),\n Encoding.UTF8,\n \"application/json\");\n\n var response = await _httpClient.PostAsync(\"chat/completions\", content);\n var responseContent = await response.Content.ReadAsStringAsync();\n\n if (!response.IsSuccessStatusCode)\n {\n var error = JsonSerializer.Deserialize<ApiError>(responseContent, _jsonOptions);\n throw new DeepseekException(\n $\"API Error: {error?.Message ?? \"Unknown error\"}\",\n response.StatusCode);\n }\n\n return JsonSerializer.Deserialize<DeepseekResponse>(responseContent, _jsonOptions);\n }\n catch (Exception ex)\n {\n throw new DeepseekException(\"Request failed\", HttpStatusCode.InternalServerError, ex);\n }\n }\n\n public async Task<DeepseekResponse> GenerateResponseAsync(string prompt)\n {\n return await GenerateResponseAsync(new DeepseekRequest\n {\n Messages = new List<Message> { new Message { Content = prompt } }\n });\n }\n }\n}\n"}}}}