Merge branch 'master' of https://github.com/SciSharp/BotSharp into features/add-utility-visibility

This commit is contained in:
Jicheng Lu 2025-05-28 20:43:00 -05:00
commit e2f2d0a0da
2 changed files with 8 additions and 7 deletions

View file

@ -70,6 +70,11 @@ public partial class AgentService
}
profile.Plugin = GetPlugin(profile.Id);
//add default instruction to ChannelInstructions
var defaultInstruction = new ChannelInstruction() { Channel = string.Empty, Instruction = profile?.Instruction };
profile.ChannelInstructions.Insert(0, defaultInstruction);
return profile;
}

View file

@ -73,14 +73,10 @@ public partial class AgentService
var state = _services.GetRequiredService<IConversationStateService>();
var channel = state.GetState("channel");
if (string.IsNullOrWhiteSpace(channel))
{
return;
}
var found = instructions.FirstOrDefault(x => x.Channel.IsEqualTo(channel));
agent.Instruction = !string.IsNullOrWhiteSpace(found?.Instruction) ? found.Instruction : agent.Instruction;
var defaultInstruction = instructions.FirstOrDefault(x => x.Channel == string.Empty);
agent.Instruction = !string.IsNullOrWhiteSpace(found?.Instruction) ? found.Instruction : defaultInstruction?.Instruction;
}
private void PopulateState(Dictionary<string, object> dict)