Added logging and changed return logic for missing or unavailable AI models in Chat/ContentText.cs

This commit is contained in:
Peer Schütt 2026-04-02 09:49:37 +02:00
parent 1b3d9ed8cd
commit b15134d876

View File

@ -169,8 +169,12 @@ public sealed class ContentText : IContent
if(chatModel.IsSystemModel)
return true;
if(string.IsNullOrWhiteSpace(chatModel.Id))
return true;
if (string.IsNullOrWhiteSpace(chatModel.Id))
{
LOGGER.LogWarning(
"Skipping AI request because model ID is null or white space.");
return false;
}
IEnumerable<Model> loadedModels;
try
@ -189,8 +193,13 @@ public sealed class ContentText : IContent
var availableModels = loadedModels.Where(model => !string.IsNullOrWhiteSpace(model.Id)).ToList();
if (availableModels.Count == 0)
return true;
{
LOGGER.LogWarning(
"Skipping AI request because there are no models available from '{ProviderInstanceName}' (provider={ProviderType}).",
provider.InstanceName, provider.Provider);
return false;
}
if(availableModels.Any(model => ModelsMatch(model, chatModel)))
return true;