refactor: 清理 AI 客户端死代码并统一错误处理
- 删除未使用的 OpenAiCompatibleClient,DTO 抽离到 ai_contracts.cs - 新增 AiHttpResponseGuard 统一 LLM/VLM 的 HTTP 错误处理: 错误响应带响应体(截断 2000 字符)、空响应与无效 JSON 显式抛 InvalidDataException - 空 catch 补全精确异常类型(IOException/UnauthorizedAccessException/JsonException) - 修正 Program.cs 数据库初始化注释 - 新增 AI 客户端错误处理单元测试
This commit is contained in:
@@ -160,6 +160,6 @@ public sealed class ReportAnalysisService(
|
||||
|
||||
content = content.Trim();
|
||||
try { return JsonDocument.Parse(content).RootElement; }
|
||||
catch { return null; }
|
||||
catch (JsonException) { return null; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user