diff --git a/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs b/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs index 1fb1f628..10635152 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/InstructResult.cs @@ -4,4 +4,5 @@ public class InstructResult { public string Text { get; set; } public object Data { get; set; } + public ConversationState States { get; set; } } diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs index 2893b7ff..8147f437 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs @@ -62,6 +62,10 @@ public partial class RoutingService response = await InvokeAgent(response.CurrentAgentId); } } + else + { + response.Role = AgentRole.Assistant; + } return response; } diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs index 9cb7b438..c34bf42a 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs @@ -46,8 +46,12 @@ public class InstructModeController : ControllerBase, IApiAdapter } var instructor = _services.GetRequiredService(); - return await instructor.Execute(agent, + var result = await instructor.Execute(agent, new RoleDialogModel(AgentRole.User, input.Text)); + + result.States = state.GetStates(); + + return result; } [HttpPost("/instruct/text-completion")] diff --git a/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid b/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid index 8416e7ae..1543518d 100644 --- a/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid +++ b/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid @@ -3,6 +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. [FUNCTIONS] {% for handler in routing_handlers %}