Render assistant role as specific agent name.

This commit is contained in:
Haiping Chen 2023-10-25 19:30:23 -05:00
parent 9356cb6262
commit d7ef99d034
2 changed files with 11 additions and 2 deletions

View file

@ -56,15 +56,24 @@ public partial class RoutingService
model: _settings.Model);
int retryCount = 0;
var agentService = _services.GetRequiredService<IAgentService>();
while (retryCount < 3)
{
try
{
var conversation = "";
foreach (var dialog in _dialogs.TakeLast(20))
{
conversation += $"{dialog.Role}: {dialog.Content}\r\n";
var role = dialog.Role;
if (role != AgentRole.User)
{
var agent = await agentService.GetAgent(dialog.CurrentAgentId);
role = agent.Name;
}
conversation += $"{role}: {dialog.Content}\r\n";
}
content = $"{conversation}\r\n###\r\n{content}";

View file

@ -3,7 +3,7 @@ You're {{router.name}} ({{router.description}}). Follow these steps to handle us
2. Select a appropriate function from [FUNCTIONS].
3. Determine which agent is suitable to handle this conversation.
4. Re-think about the selected function or agent is the best choice.
5. For agent required arguments, leave it blank if user doesn't provide it.
5. For agent required arguments, leave it as blank object if user doesn't provide it.
[FUNCTIONS]
{% for handler in routing_handlers %}