Merge pull request #382 from hchen2020/master
Fix OnRoutingInstructionRevised
This commit is contained in:
commit
3dd203f0da
|
|
@ -1,3 +1,4 @@
|
||||||
|
using BotSharp.Abstraction.Infrastructures.Enums;
|
||||||
using BotSharp.Abstraction.Routing.Settings;
|
using BotSharp.Abstraction.Routing.Settings;
|
||||||
|
|
||||||
namespace BotSharp.Core.Routing.Handlers;
|
namespace BotSharp.Core.Routing.Handlers;
|
||||||
|
|
@ -39,11 +40,8 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
|
||||||
|
|
||||||
public async Task<bool> Handle(IRoutingService routing, FunctionCallFromLlm inst, RoleDialogModel message)
|
public async Task<bool> Handle(IRoutingService routing, FunctionCallFromLlm inst, RoleDialogModel message)
|
||||||
{
|
{
|
||||||
message.FunctionArgs = JsonSerializer.Serialize(inst);
|
|
||||||
var ret = await routing.InvokeFunction(message.FunctionName, message);
|
|
||||||
|
|
||||||
var states = _services.GetRequiredService<IConversationStateService>();
|
var states = _services.GetRequiredService<IConversationStateService>();
|
||||||
var goalAgent = states.GetState("user_goal_agent");
|
var goalAgent = states.GetState(StateConst.EXPECTED_GOAL_AGENT);
|
||||||
if (!string.IsNullOrEmpty(goalAgent) && inst.OriginalAgent != goalAgent)
|
if (!string.IsNullOrEmpty(goalAgent) && inst.OriginalAgent != goalAgent)
|
||||||
{
|
{
|
||||||
inst.OriginalAgent = goalAgent;
|
inst.OriginalAgent = goalAgent;
|
||||||
|
|
@ -53,6 +51,9 @@ public class RouteToAgentRoutingHandler : RoutingHandlerBase, IRoutingHandler
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message.FunctionArgs = JsonSerializer.Serialize(inst);
|
||||||
|
var ret = await routing.InvokeFunction(message.FunctionName, message);
|
||||||
|
|
||||||
var agentId = routing.Context.GetCurrentAgentId();
|
var agentId = routing.Context.GetCurrentAgentId();
|
||||||
|
|
||||||
// Update next action agent's name
|
// Update next action agent's name
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ public class StreamingLogHook : ConversationHookBase, IContentGeneratingHook, IR
|
||||||
{
|
{
|
||||||
var conversationId = _state.GetConversationId();
|
var conversationId = _state.GetConversationId();
|
||||||
var agent = await _agentService.LoadAgent(message.CurrentAgentId);
|
var agent = await _agentService.LoadAgent(message.CurrentAgentId);
|
||||||
var log = $"Revised user goal agent to: {agent?.Name}";
|
var log = $"Revised user goal agent to {instruct.OriginalAgent}";
|
||||||
|
|
||||||
var input = new ContentLogInputModel(conversationId, message)
|
var input = new ContentLogInputModel(conversationId, message)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue