Merge pull request #313 from iceljc/features/refine-content-log

refine content log after call bot
This commit is contained in:
C. Oceania 2024-02-21 11:00:47 -06:00 committed by GitHub
commit 9f31f84feb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -82,7 +82,18 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook
var conversationId = _state.GetConversationId();
var agent = await agentService.LoadAgent(message.CurrentAgentId);
await _chatHub.Clients.User(_user.Id).SendAsync("OnConversationContentLogGenerated", BuildContentLog(conversationId, agent?.Name, tokenStats.Prompt, message));
string log;
if (message.Role == AgentRole.Function)
{
log = $"[{agent?.Name}]: {message.FunctionName}({message.FunctionArgs}) => {message.Content}";
log += $"\r\n<== MessageId: {message.MessageId}";
}
else
{
log = tokenStats.Prompt;
}
await _chatHub.Clients.User(_user.Id).SendAsync("OnConversationContentLogGenerated", BuildContentLog(conversationId, agent?.Name, log, message));
}
/// <summary>