append image analysis prompt

This commit is contained in:
Jicheng Lu 2024-06-18 13:18:24 -05:00
parent 7d99ad845b
commit 3de77403d7

View file

@ -1,3 +1,4 @@
namespace BotSharp.Core.Files.Hooks;
public class AttachmentProcessingHook : AgentHookBase
@ -14,6 +15,20 @@ public class AttachmentProcessingHook : AgentHookBase
_agentSettings = settings;
}
public override void OnAgentLoaded(Agent agent)
{
var fileService = _services.GetRequiredService<IBotSharpFileService>();
var conv = _services.GetRequiredService<IConversationService>();
var hasConvFiles = fileService.HasConversationUserFiles(conv.ConversationId);
if (hasConvFiles)
{
agent.Instruction += "\r\n\r\nIf user wants to describe images or pdf files, please call load_attachment.";
}
base.OnAgentLoaded(agent);
}
public override bool OnFunctionsLoaded(List<FunctionDef> functions)
{
var fileService = _services.GetRequiredService<IBotSharpFileService>();