Files
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
3.1 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": "chara123977/snakegame", "files": {"LLMService.cs": {"c4cc331885cf5170e279486668f7862deecb95c1": {"t": 1786068391.6306505, "n": 2830, "h": "2b90fc206cbea848", "c": "// LLMService.cs\nusing System;\nusing System.Net.Http;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Serialization.Metadata;\nusing System.Threading.Tasks;\n\nnamespace snakegame\n{\n public class DeepSeekRequest\n {\n public string Model { get; set; } = \"deepseek-chat\";\n public DeepSeekMessage[] Messages { get; set; } = Array.Empty<DeepSeekMessage>();\n public double Temperature { get; set; } = 0.7;\n }\n\n public class DeepSeekMessage\n {\n public string Role { get; set; } = \"user\";\n public string Content { get; set; } = \"\";\n }\n\n public class DeepSeekResponse\n {\n public DeepSeekChoice[] Choices { get; set; } = Array.Empty<DeepSeekChoice>();\n }\n\n public class DeepSeekChoice\n {\n public DeepSeekMessage Message { get; set; } = new();\n }\n\n public class LLMService\n {\n // 替换为你的 DeepSeek API Key(从 https://platform.deepseek.com 获取)\n private readonly string apiKey = \"sk-44fa664c8bf844b6a98fbcbc54770684\";\n private readonly string endpoint = \"https://api.deepseek.com/v1/chat/completions\";\n\n private readonly JsonSerializerOptions jsonOptions = new()\n {\n PropertyNamingPolicy = JsonNamingPolicy.CamelCase,\n TypeInfoResolver = new DefaultJsonTypeInfoResolver()\n };\n\n public async Task<string> GetResponseAsync(string prompt)\n {\n using var client = new HttpClient();\n client.DefaultRequestHeaders.Add(\"Authorization\", $\"Bearer {apiKey}\");\n client.DefaultRequestHeaders.Add(\"User-Agent\", \"SnakeGame/1.0\");\n\n var requestBody = new DeepSeekRequest\n {\n Messages = new[] { new DeepSeekMessage { Role = \"user\", Content = prompt } },\n Temperature = 0.5 // 更稳定输出\n };\n\n string json = JsonSerializer.Serialize(requestBody, jsonOptions);\n var content = new StringContent(json, Encoding.UTF8, \"application/json\");\n\n try\n {\n var response = await client.PostAsync(endpoint, content);\n string responseText = await response.Content.ReadAsStringAsync();\n\n if (!response.IsSuccessStatusCode)\n {\n return $\"DeepSeek API 错误 ({response.StatusCode}): {responseText}\";\n }\n\n // 使用 JsonSerializer 反序列化响应(也可用 JsonDocument,这里统一用类型)\n var resp = JsonSerializer.Deserialize<DeepSeekResponse>(responseText, jsonOptions);\n return resp?.Choices.Length > 0\n ? resp.Choices[0].Message.Content.Trim()\n : \"DeepSeek 未返回有效内容\";\n }\n catch (Exception ex)\n {\n return $\"调用 DeepSeek 失败: {ex.Message}\";\n }\n }\n }\n}"}}}}