Merge pull request #131 from hchen2020/master

Fix get agents in user external id.
This commit is contained in:
Haiping 2023-09-03 21:23:57 -05:00 committed by GitHub
commit bf51213a5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -10,7 +10,8 @@ public partial class AgentService
var db = _services.GetRequiredService<IBotSharpRepository>();
var query = from a in db.Agent
join ua in db.UserAgent on a.Id equals ua.AgentId
where ua.UserId == _user.Id
join u in db.User on ua.UserId equals u.Id
where ua.UserId == _user.Id || u.ExternalId == _user.Id
select a.ToAgent();
return query.ToList();
}

View file

@ -96,6 +96,8 @@ public class ChatCompletionProvider : IChatCompletion
var choice = response.Value.Choices[0];
var message = choice.Message;
_logger.LogInformation($"Token Usage: {response.Value.Usage.PromptTokens} prompt + {response.Value.Usage.CompletionTokens} completion = {response.Value.Usage.TotalTokens} total");
if (choice.FinishReason == CompletionsFinishReason.FunctionCall)
{
_logger.LogInformation($"[{agent.Name}]: {message.FunctionCall.Name} => {message.FunctionCall.Arguments}");