@@ -20,21 +20,25 @@ public InstructModeController(IServiceProvider services)
20
20
}
21
21
22
22
[ HttpPost ( "/instruct/{agentId}" ) ]
23
- public async Task < InstructResult > NewConversation ( [ FromRoute ] string agentId ,
23
+ public async Task < InstructResult > InstructCompletion ( [ FromRoute ] string agentId ,
24
24
[ FromBody ] InstructMessageModel input )
25
25
{
26
26
var instructor = _services . GetRequiredService < IInstructService > ( ) ;
27
27
var agentService = _services . GetRequiredService < IAgentService > ( ) ;
28
28
Agent agent = await agentService . LoadAgent ( agentId ) ;
29
29
30
30
// switch to different instruction template
31
- if ( ! string . IsNullOrEmpty ( input . TemplateName ) )
31
+ if ( ! string . IsNullOrEmpty ( input . Template ) )
32
32
{
33
33
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 } ") ;
35
35
agent . Instruction = System . IO . File . ReadAllText ( filePath ) ;
36
36
}
37
37
38
+ var conv = _services . GetRequiredService < IConversationService > ( ) ;
39
+ conv . States . SetState ( "provider" , input . Provider )
40
+ . SetState ( "model" , input . Model ) ;
41
+
38
42
return await instructor . ExecuteInstruction ( agent ,
39
43
new RoleDialogModel ( AgentRole . User , input . Text ) ,
40
44
fn => Task . CompletedTask ,
0 commit comments