File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/Plugins/BotSharp.Plugin.FileHandler/Functions Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -22,21 +22,22 @@ public async Task<bool> Execute(RoleDialogModel message)
2222 var conv = _services . GetRequiredService < IConversationService > ( ) ;
2323 var agentService = _services . GetRequiredService < IAgentService > ( ) ;
2424
25+ Agent ? fromAgent = null ;
26+ if ( ! string . IsNullOrEmpty ( message . CurrentAgentId ) )
27+ {
28+ fromAgent = await agentService . LoadAgent ( message . CurrentAgentId ) ;
29+ }
30+
2531 var wholeDialogs = conv . GetDialogHistory ( ) ;
2632 var dialogs = AssembleFiles ( conv . ConversationId , args ? . ImageUrls , wholeDialogs ) ;
2733 var agent = new Agent
2834 {
2935 Id = BuiltInAgentId . UtilityAssistant ,
3036 Name = "Utility Agent" ,
31- Instruction = ! string . IsNullOrWhiteSpace ( args ? . UserRequest ) ? args . UserRequest : "Please describe the image(s)." ,
37+ Instruction = fromAgent ? . Instruction ?? args . UserRequest ?? "Please describe the image(s)." ,
3238 TemplateDict = new Dictionary < string , object > ( )
3339 } ;
3440
35- if ( ! string . IsNullOrEmpty ( message . CurrentAgentId ) )
36- {
37- agent = await agentService . LoadAgent ( message . CurrentAgentId , loadUtility : false ) ;
38- }
39-
4041 var response = await GetChatCompletion ( agent , dialogs ) ;
4142 message . Content = response ;
4243 return true ;
You can’t perform that action at this time.
0 commit comments