Merge pull request #1042 from JackJiang1234/master

Update AgentService.GetAgents.cs
This commit is contained in:
易磊 2025-04-30 17:16:17 +08:00 committed by GitHub
commit 25230fe025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,13 +44,17 @@ public partial class AgentService
[SharpCache(10)]
public async Task<Agent> GetAgent(string id)
{
var profile = _db.GetAgent(id);
if (string.IsNullOrWhiteSpace(id))
{
return null;
}
if (profile == null)
{
//_logger.LogError($"Can't find agent {id}");
throw new ArgumentException($"Can't find agent {id}");
}
var profile = _db.GetAgent(id);
if (profile == null)
{
_logger.LogError($"Can't find agent {id}");
return null;
}
// Load llm config
var agentSetting = _services.GetRequiredService<AgentSettings>();