Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using BotSharp.Abstraction.Hooks;
using BotSharp.Abstraction.Instructs;
using BotSharp.Abstraction.Instructs.Models;
using BotSharp.Abstraction.MLTasks;
Expand All @@ -13,6 +12,15 @@ public async Task<InstructResult> Execute(string agentId, RoleDialogModel messag
var agentService = _services.GetRequiredService<IAgentService>();
Agent agent = await agentService.LoadAgent(agentId);

if (agent == null)
{
return new InstructResult
{
MessageId = message.MessageId,
Text = $"Agent (id: {agentId}) does not exist!"
};
}

if (agent.Disabled)
{
var content = $"This agent ({agent.Name}) is disabled, please install the corresponding plugin ({agent.Plugin.Name}) to activate this agent.";
Expand Down Expand Up @@ -55,6 +63,7 @@ public async Task<InstructResult> Execute(string agentId, RoleDialogModel messag
{
MessageId = message.MessageId
};

if (completer is ITextCompletion textCompleter)
{
instruction = null;
Expand Down Expand Up @@ -86,7 +95,7 @@ public async Task<InstructResult> Execute(string agentId, RoleDialogModel messag
{
CurrentAgentId = agentId,
MessageId = message.MessageId,
Files = files?.Select(x => new BotSharpFile { FileUrl = x.FileUrl, FileData = x.FileData }).ToList() ?? []
Files = files?.Select(x => new BotSharpFile { FileUrl = x.FileUrl, FileData = x.FileData, ContentType = x.ContentType }).ToList() ?? []
}
});
response.Text = result.Content;
Expand Down
Loading