Skip to content

Commit 7f60133

Browse files
committed
change utility assistant id
1 parent ae5e65b commit 7f60133

File tree

17 files changed

+25
-30
lines changed

17 files changed

+25
-30
lines changed

src/Infrastructure/BotSharp.Abstraction/Agents/Enums/BuiltInAgentId.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ public class BuiltInAgentId
55
public const string AIAssistant = "01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a";
66
public const string Chatbot = "01e2fc5c-2c89-4ec7-8470-7688608b496c";
77
public const string HumanSupport = "01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b";
8+
public const string UtilityAssistant = "6745151e-6d46-4a02-8de4-1c4f21c7da95";
89
}

src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.LoadAgent.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
using BotSharp.Abstraction.Templating;
2-
31
namespace BotSharp.Core.Agents.Services;
42

53
public partial class AgentService
64
{
75
[MemoryCache(10 * 60, perInstanceCache: true)]
86
public async Task<Agent> LoadAgent(string id)
97
{
10-
if (string.IsNullOrEmpty(id))
8+
if (string.IsNullOrEmpty(id) || id == Guid.Empty.ToString())
119
{
1210
return null;
1311
}

src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
</PropertyGroup>
4747

4848
<ItemGroup>
49-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\agent.json" />
50-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\functions\generate_image.json" />
51-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\functions\read_file.json" />
52-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\instruction.liquid" />
53-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\templates\generate_image.fn.liquid" />
54-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\templates\read_file.fn.liquid" />
49+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\agent.json" />
50+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\generate_image.json" />
51+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\read_file.json" />
52+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\instruction.liquid" />
53+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\generate_image.fn.liquid" />
54+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\read_file.fn.liquid" />
5555
<None Remove="data\agents\01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b\agent.json" />
5656
<None Remove="data\agents\01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b\functions.json" />
5757
<None Remove="data\agents\01dcc3e5-0af7-49e6-ad7a-a760bd12dc4b\functions\human_intervention_needed.json" />
@@ -153,22 +153,22 @@
153153
<Content Include="data\agents\01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a\templates\conversation.summary.liquid">
154154
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
155155
</Content>
156-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\agent.json">
156+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\agent.json">
157157
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
158158
</Content>
159-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\instruction.liquid">
159+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\instruction.liquid">
160160
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161161
</Content>
162-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\functions\read_file.json">
162+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\read_file.json">
163163
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164164
</Content>
165-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\templates\read_file.fn.liquid">
165+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\read_file.fn.liquid">
166166
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
167167
</Content>
168-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\functions\generate_image.json">
168+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\generate_image.json">
169169
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
170170
</Content>
171-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\templates\generate_image.fn.liquid">
171+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\generate_image.fn.liquid">
172172
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
173173
</Content>
174174
<Content Include="data\plugins\config.json">

src/Infrastructure/BotSharp.Core/Files/Functions/GenerateImageFn.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ public class GenerateImageFn : IFunctionCallback
99

1010
private readonly IServiceProvider _services;
1111
private readonly ILogger<GenerateImageFn> _logger;
12-
private static string UTILITY_ASSISTANT = Guid.Empty.ToString();
1312
private string _conversationId;
1413
private string _messageId;
1514

@@ -29,7 +28,7 @@ public async Task<bool> Execute(RoleDialogModel message)
2928
SetImageOptions();
3029

3130
var agentService = _services.GetRequiredService<IAgentService>();
32-
var agent = await agentService.LoadAgent(UTILITY_ASSISTANT);
31+
var agent = await agentService.LoadAgent(BuiltInAgentId.UtilityAssistant);
3332
var imageAgent = new Agent
3433
{
3534
Id = agent?.Id ?? Guid.Empty.ToString(),

src/Infrastructure/BotSharp.Core/Files/Functions/ReadFileFn.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class ReadFileFn : IFunctionCallback
1212
private readonly ILogger<ReadFileFn> _logger;
1313
private readonly IEnumerable<string> _imageTypes = new List<string> { "image", "images", "png", "jpg", "jpeg" };
1414
private readonly IEnumerable<string> _pdfTypes = new List<string> { "pdf" };
15-
private static string UTILITY_ASSISTANT = Guid.Empty.ToString();
1615

1716
public ReadFileFn(
1817
IServiceProvider services,
@@ -31,7 +30,7 @@ public async Task<bool> Execute(RoleDialogModel message)
3130
var wholeDialogs = conv.GetDialogHistory();
3231
var fileTypes = args?.FileTypes?.Split(",", StringSplitOptions.RemoveEmptyEntries)?.ToList() ?? new List<string>();
3332
var dialogs = await AssembleFiles(conv.ConversationId, wholeDialogs, fileTypes);
34-
var agent = await agentService.LoadAgent(UTILITY_ASSISTANT);
33+
var agent = await agentService.LoadAgent(BuiltInAgentId.UtilityAssistant);
3534
var fileAgent = new Agent
3635
{
3736
Id = agent?.Id ?? Guid.Empty.ToString(),

src/Infrastructure/BotSharp.Core/Files/Hooks/FileReaderHook.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ namespace BotSharp.Core.Files.Hooks;
22

33
public class FileReaderHook : AgentHookBase
44
{
5-
private static string UTILITY_ASSISTANT = Guid.Empty.ToString();
65
private static string FUNCTION_NAME = "read_file";
76

87
public override string SelfId => string.Empty;
@@ -45,7 +44,7 @@ public override void OnAgentLoaded(Agent agent)
4544
private (string, FunctionDef?) GetPromptAndFunction()
4645
{
4746
var db = _services.GetRequiredService<IBotSharpRepository>();
48-
var agent = db.GetAgent(UTILITY_ASSISTANT);
47+
var agent = db.GetAgent(BuiltInAgentId.UtilityAssistant);
4948
var prompt = agent?.Templates?.FirstOrDefault(x => x.Name.IsEqualTo($"{FUNCTION_NAME}.fn"))?.Content ?? string.Empty;
5049
var loadAttachmentFn = agent?.Functions?.FirstOrDefault(x => x.Name.IsEqualTo(FUNCTION_NAME));
5150
return (prompt, loadAttachmentFn);

src/Infrastructure/BotSharp.Core/Files/Hooks/ImageGeneratorHook.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ namespace BotSharp.Core.Files.Hooks;
22

33
public class ImageGeneratorHook : AgentHookBase
44
{
5-
private static string UTILITY_ASSISTANT = Guid.Empty.ToString();
65
private static string FUNCTION_NAME = "generate_image";
76

87
public override string SelfId => string.Empty;
@@ -45,7 +44,7 @@ public override void OnAgentLoaded(Agent agent)
4544
private (string, FunctionDef?) GetPromptAndFunction()
4645
{
4746
var db = _services.GetRequiredService<IBotSharpRepository>();
48-
var agent = db.GetAgent(UTILITY_ASSISTANT);
47+
var agent = db.GetAgent(BuiltInAgentId.UtilityAssistant);
4948
var prompt = agent?.Templates?.FirstOrDefault(x => x.Name.IsEqualTo($"{FUNCTION_NAME}.fn"))?.Content ?? string.Empty;
5049
var loadAttachmentFn = agent?.Functions?.FirstOrDefault(x => x.Name.IsEqualTo(FUNCTION_NAME));
5150
return (prompt, loadAttachmentFn);

src/Infrastructure/BotSharp.Core/data/agents/00000000-0000-0000-0000-000000000000/agent.json renamed to src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/agent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"id": "00000000-0000-0000-0000-000000000000",
2+
"id": "6745151e-6d46-4a02-8de4-1c4f21c7da95",
33
"name": "Utility Assistant",
44
"description": "Utility assistant that can be used to complete many different tasks",
55
"type": "static",

src/Plugins/BotSharp.Plugin.HttpHandler/BotSharp.Plugin.HttpHandler.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\functions\handle_http_request.json" />
15-
<None Remove="data\agents\00000000-0000-0000-0000-000000000000\templates\handle_http_request.fn.liquid" />
14+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_http_request.json" />
15+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_http_request.fn.liquid" />
1616
<None Remove="data\agents\87c458fc-ec5f-40ae-8ed6-05dda8a07523\agent.json" />
1717
<None Remove="data\agents\87c458fc-ec5f-40ae-8ed6-05dda8a07523\functions.json" />
1818
<None Remove="data\agents\87c458fc-ec5f-40ae-8ed6-05dda8a07523\instruction.liquid" />
@@ -25,10 +25,10 @@
2525
<Content Include="data\agents\87c458fc-ec5f-40ae-8ed6-05dda8a07523\instruction.liquid">
2626
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2727
</Content>
28-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\functions\handle_http_request.json">
28+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_http_request.json">
2929
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3030
</Content>
31-
<Content Include="data\agents\00000000-0000-0000-0000-000000000000\templates\handle_http_request.fn.liquid">
31+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_http_request.fn.liquid">
3232
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3333
</Content>
3434
</ItemGroup>

src/Plugins/BotSharp.Plugin.HttpHandler/Hooks/HttpHandlerHook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BotSharp.Abstraction.Agents;
2+
using BotSharp.Abstraction.Agents.Enums;
23
using BotSharp.Abstraction.Agents.Settings;
34
using BotSharp.Abstraction.Functions.Models;
45
using BotSharp.Abstraction.Repositories;
@@ -8,7 +9,6 @@ namespace BotSharp.Plugin.HttpHandler.Hooks;
89

910
public class HttpHandlerHook : AgentHookBase
1011
{
11-
private static string UTILITY_ASSISTANT = Guid.Empty.ToString();
1212
private static string FUNCTION_NAME = "handle_http_request";
1313

1414
public override string SelfId => string.Empty;
@@ -51,7 +51,7 @@ public override void OnAgentLoaded(Agent agent)
5151
private (string, FunctionDef?) GetPromptAndFunction()
5252
{
5353
var db = _services.GetRequiredService<IBotSharpRepository>();
54-
var agent = db.GetAgent(UTILITY_ASSISTANT);
54+
var agent = db.GetAgent(BuiltInAgentId.UtilityAssistant);
5555
var prompt = agent?.Templates?.FirstOrDefault(x => x.Name.IsEqualTo($"{FUNCTION_NAME}.fn"))?.Content ?? string.Empty;
5656
var loadAttachmentFn = agent?.Functions?.FirstOrDefault(x => x.Name.IsEqualTo(FUNCTION_NAME));
5757
return (prompt, loadAttachmentFn);

0 commit comments

Comments
 (0)