Spaces:
Running
Running
Commit ·
bfcec43
1
Parent(s): 248dd04
fix(AIService): robust model name validation to fallback to gemini-2.5-flash if configured model looks like API key
Browse files121 unmodified lines12212312412512612748 unmodified lines176177178179180181182121 unmodified lines}var model = _config["Gemini:Model"] ?? "gemini-2.5-flash";if (model.StartsWith("models/")){model = model.Substring("models/".Length);48 unmodified linesif (!response.IsSuccessStatusCode){throw new Exception($"Gemini API error (Status {response.StatusCode}) with model '{model}': {responseString}");}using var doc = JsonDocument.Parse(responseString);121 unmodified lines12212312412512612712812913013113213313413513648 unmodified lines185186187188189190191121 unmodified lines}var model = _config["Gemini:Model"] ?? "gemini-2.5-flash";if (string.IsNullOrWhiteSpace(model) ||model.StartsWith("AIzaSy", StringComparison.OrdinalIgnoreCase) ||model.StartsWith("AQ.Ab", StringComparison.OrdinalIgnoreCase) ||model.Length > 30 ||!model.Contains("gemini", StringComparison.OrdinalIgnoreCase)){model = "gemini-2.5-flash";}if (model.StartsWith("models/")){model = model.Substring("models/".Length);48 unmodified linesif (!response.IsSuccessStatusCode){throw new Exception($"Gemini API error (Status {response.StatusCode}): {responseString}");}using var doc = JsonDocument.Parse(responseString);
FlowAPI.Application/Services/AIService.cs+10-1