commit
c951131cba
|
|
@ -37,6 +37,7 @@ public partial class RoutingService : IRoutingService
|
|||
storage.Append(conv.ConversationId, message);
|
||||
|
||||
var dialogs = conv.GetDialogHistory();
|
||||
Context.SetDialogs(dialogs);
|
||||
handler.SetDialogs(dialogs);
|
||||
|
||||
var inst = new FunctionCallFromLlm
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ public class ReadImageFn : IFunctionCallback
|
|||
fromAgent = await agentService.LoadAgent(message.CurrentAgentId);
|
||||
}
|
||||
|
||||
var wholeDialogs = routingCtx.GetDialogs();
|
||||
var dialogs = AssembleFiles(conv.ConversationId, args?.ImageUrls, wholeDialogs);
|
||||
var agent = new Agent
|
||||
{
|
||||
Id = BuiltInAgentId.UtilityAssistant,
|
||||
|
|
@ -41,6 +39,13 @@ public class ReadImageFn : IFunctionCallback
|
|||
TemplateDict = new Dictionary<string, object>()
|
||||
};
|
||||
|
||||
var wholeDialogs = routingCtx.GetDialogs();
|
||||
if (wholeDialogs.IsNullOrEmpty())
|
||||
{
|
||||
wholeDialogs = conv.GetDialogHistory();
|
||||
}
|
||||
|
||||
var dialogs = AssembleFiles(conv.ConversationId, args?.ImageUrls, wholeDialogs);
|
||||
var response = await GetChatCompletion(agent, dialogs);
|
||||
message.Content = response;
|
||||
return true;
|
||||
|
|
@ -76,7 +81,7 @@ public class ReadImageFn : IFunctionCallback
|
|||
|
||||
if (!imageUrls.IsNullOrEmpty())
|
||||
{
|
||||
var lastDialog = dialogs.Last();
|
||||
var lastDialog = dialogs.LastOrDefault(x => x.Role == AgentRole.User) ?? dialogs.Last();
|
||||
var files = lastDialog.Files ?? [];
|
||||
var addnFiles = imageUrls.Select(x => x?.Trim())
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
|
|
|
|||
Loading…
Reference in a new issue