This commit is contained in:
Haiping Chen 2024-02-20 22:31:30 -06:00
commit e043476972
2 changed files with 14 additions and 8 deletions

View file

@ -1,9 +1,7 @@
using BotSharp.Abstraction.Loggers.Models;
using BotSharp.Abstraction.Messaging;
using BotSharp.Abstraction.Messaging.Enums;
using BotSharp.Abstraction.Messaging.JsonConverters;
using BotSharp.Abstraction.Messaging.Models.RichContent;
using BotSharp.Abstraction.Repositories;
using Microsoft.AspNetCore.SignalR;
namespace BotSharp.Plugin.ChatHub.Hooks;

View file

@ -1,14 +1,11 @@
using BotSharp.Abstraction.Agents;
using BotSharp.Abstraction.Agents.Models;
using BotSharp.Abstraction.Conversations.Models;
using BotSharp.Abstraction.Functions.Models;
using BotSharp.Abstraction.Loggers;
using BotSharp.Abstraction.Loggers.Models;
using BotSharp.Abstraction.Messaging.Models.RichContent;
using BotSharp.Abstraction.Messaging;
using BotSharp.Abstraction.Repositories;
using BotSharp.Core.Agents.Services;
using BotSharp.Abstraction.Repositories.Filters;
using BotSharp.Abstraction.Routing.Settings;
using Microsoft.AspNetCore.SignalR;
using Microsoft.VisualBasic;
namespace BotSharp.Plugin.ChatHub.Hooks;
@ -83,6 +80,17 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook
var agent = await agentService.LoadAgent(message.CurrentAgentId);
await _chatHub.Clients.User(_user.Id).SendAsync("OnConversationContentLogGenerated", BuildContentLog(conversationId, agent?.Name, tokenStats.Prompt, message));
// Log routing output
try
{
var inst = message.Content.JsonContent<FunctionCallFromLlm>();
await _chatHub.Clients.User(_user.Id).SendAsync("OnConversationContentLogGenerated", BuildContentLog(conversationId, agent?.Name, message.Content, message));
}
catch
{
// ignore
}
}
/// <summary>