Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/blueemb3r_parkknowledgeapi.json
T
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.9 KiB
JSON

{"repo": "blueemb3r/parkknowledgeapi", "files": {"ParkKnowledgeAPI/Functions/HealthFunction.cs": {"205665b87655e1970f9b70fb11b13169bc01b3b2": {"t": 1786068393.0587766, "n": 3585, "h": "818c3d43775a60cf", "c": "using Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Azure.Functions.Worker;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.Logging;\nusing Qdrant.Client;\n\nnamespace ParkKnowledgeAPI.Functions;\n\npublic class HealthFunction\n{\n private readonly QdrantClient _qdrantClient;\n private readonly IConfiguration _configuration;\n private readonly ILogger<HealthFunction> _logger;\n\n public HealthFunction(QdrantClient qdrantClient, IConfiguration configuration, ILogger<HealthFunction> logger)\n {\n _qdrantClient = qdrantClient;\n _configuration = configuration;\n _logger = logger;\n }\n\n [Function(\"Health\")]\n public async Task<IActionResult> Run(\n [HttpTrigger(AuthorizationLevel.Anonymous, \"get\", Route = \"v1/health\")] HttpRequest req)\n {\n var qdrantCheck = await CheckQdrantAsync();\n var deepSeekCheck = CheckDeepSeek();\n var onnxCheck = CheckOnnxModel();\n\n // Roll up to \"degraded\" if any single module is down\n var allHealthy = qdrantCheck.Status == \"healthy\"\n && deepSeekCheck.Status == \"healthy\"\n && onnxCheck.Status == \"healthy\";\n\n var result = new\n {\n status = allHealthy ? \"healthy\" : \"degraded\",\n modules = new\n {\n qdrant = qdrantCheck,\n deepSeek = deepSeekCheck,\n onnxEmbedding = onnxCheck\n }\n };\n\n return new OkObjectResult(result);\n }\n\n // Uses ListCollections as a lightweight ping — if Qdrant is unreachable, the gRPC call throws\n private async Task<ComponentHealth> CheckQdrantAsync()\n {\n try\n {\n var collections = await _qdrantClient.ListCollectionsAsync();\n return new ComponentHealth(\"healthy\", $\"{collections.Count} collection(s)\");\n }\n catch (Exception ex)\n {\n _logger.LogWarning(ex, \"Qdrant health check failed\");\n return new ComponentHealth(\"unhealthy\", ex.Message);\n }\n }\n\n // Config-only check — doesn't call the DeepSeek API to avoid latency and rate-limit costs\n private ComponentHealth CheckDeepSeek()\n {\n var apiKey = _configuration[\"DeepSeek:ApiKey\"];\n var endpoint = _configuration[\"DeepSeek:Endpoint\"];\n var modelId = _configuration[\"DeepSeek:ModelId\"];\n\n if (string.IsNullOrWhiteSpace(apiKey))\n return new ComponentHealth(\"unhealthy\", \"API key not configured\");\n\n return new ComponentHealth(\"healthy\", $\"model={modelId ?? \"deepseek-chat\"}, endpoint={endpoint ?? \"https://api.deepseek.com\"}\");\n }\n\n // Verifies the ONNX model files exist on disk (all-MiniLM-L6-v2, ~86MB + vocab)\n private ComponentHealth CheckOnnxModel()\n {\n // BaseDirectory points to the build output where CopyToOutputDirectory places the files\n var modelPath = Path.Combine(AppContext.BaseDirectory, \"Models\", \"onnx\", \"model.onnx\");\n var vocabPath = Path.Combine(AppContext.BaseDirectory, \"Models\", \"onnx\", \"vocab.txt\");\n\n if (!File.Exists(modelPath))\n return new ComponentHealth(\"unhealthy\", $\"model.onnx not found at {modelPath}\");\n\n if (!File.Exists(vocabPath))\n return new ComponentHealth(\"unhealthy\", $\"vocab.txt not found at {vocabPath}\");\n\n var modelSize = new FileInfo(modelPath).Length;\n return new ComponentHealth(\"healthy\", $\"model.onnx={modelSize / (1024 * 1024)}MB\");\n }\n\n private record ComponentHealth(string Status, string Details);\n}\n"}}}}