@@ -20,21 +20,25 @@ public InstructModeController(IServiceProvider services)
2020 }
2121
2222 [ HttpPost ( "/instruct/{agentId}" ) ]
23- public async Task < InstructResult > NewConversation ( [ FromRoute ] string agentId ,
23+ public async Task < InstructResult > InstructCompletion ( [ FromRoute ] string agentId ,
2424 [ FromBody ] InstructMessageModel input )
2525 {
2626 var instructor = _services . GetRequiredService < IInstructService > ( ) ;
2727 var agentService = _services . GetRequiredService < IAgentService > ( ) ;
2828 Agent agent = await agentService . LoadAgent ( agentId ) ;
2929
3030 // switch to different instruction template
31- if ( ! string . IsNullOrEmpty ( input . TemplateName ) )
31+ if ( ! string . IsNullOrEmpty ( input . Template ) )
3232 {
3333 var agentSettings = _services . GetRequiredService < AgentSettings > ( ) ;
34- var filePath = Path . Combine ( agentService . GetAgentDataDir ( agentId ) , $ "{ input . TemplateName } .{ agentSettings . TemplateFormat } ") ;
34+ var filePath = Path . Combine ( agentService . GetAgentDataDir ( agentId ) , $ "{ input . Template } .{ agentSettings . TemplateFormat } ") ;
3535 agent . Instruction = System . IO . File . ReadAllText ( filePath ) ;
3636 }
3737
38+ var conv = _services . GetRequiredService < IConversationService > ( ) ;
39+ conv . States . SetState ( "provider" , input . Provider )
40+ . SetState ( "model" , input . Model ) ;
41+
3842 return await instructor . ExecuteInstruction ( agent ,
3943 new RoleDialogModel ( AgentRole . User , input . Text ) ,
4044 fn => Task . CompletedTask ,
0 commit comments