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:
@@ -521,7 +521,7 @@ public static class AiChatEndpoints
|
||||
var json = JsonSerializer.Serialize(toolResult, JsonOpts);
|
||||
resultDict = JsonSerializer.Deserialize<Dictionary<string, object>>(json, JsonOpts);
|
||||
}
|
||||
catch { resultDict = new Dictionary<string, object>(); }
|
||||
catch (JsonException) { resultDict = new Dictionary<string, object>(); }
|
||||
}
|
||||
|
||||
var isPendingConfirmation = resultDict != null
|
||||
|
||||
Reference in New Issue
Block a user