Skip to content

Commit c57ca81

Browse files
authored
Merge pull request #781 from iceljc/master
refine utility name
2 parents bf0baf4 + 8b7f804 commit c57ca81

File tree

82 files changed

+553
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+553
-163
lines changed

src/Infrastructure/BotSharp.Abstraction/Agents/AgentHookBase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ public virtual void OnAgentUtilityLoaded(Agent agent)
116116
return ([], []);
117117
}
118118

119+
var prefix = "util-";
119120
utilities = utilities?.Where(x => !string.IsNullOrEmpty(x.Name) && !x.Disabled)?.ToList() ?? [];
120121
var functionNames = utilities.SelectMany(x => x.Functions)
121-
.Where(x => !string.IsNullOrEmpty(x.Name))
122+
.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.StartsWith(prefix))
122123
.Select(x => x.Name)
123124
.Distinct().ToList();
124125
var templateNames = utilities.SelectMany(x => x.Templates)
125-
.Where(x => !string.IsNullOrEmpty(x.Name))
126+
.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.StartsWith(prefix))
126127
.Select(x => x.Name)
127128
.Distinct().ToList();
128129

src/Plugins/BotSharp.Plugin.AudioHandler/BotSharp.Plugin.AudioHandler.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_audio_request.json" />
28-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_audio_request.fn.liquid" />
27+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-audio-handle_audio_request.json" />
28+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-audio-handle_audio_request.fn.liquid" />
2929
</ItemGroup>
3030

3131
<ItemGroup>
32-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_audio_request.fn.liquid">
32+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-audio-handle_audio_request.fn.liquid">
3333
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3434
</Content>
35-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_audio_request.json">
35+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-audio-handle_audio_request.json">
3636
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3737
</Content>
3838
</ItemGroup>

src/Plugins/BotSharp.Plugin.AudioHandler/Enums/UtilityName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ namespace BotSharp.Plugin.AudioHandler.Enums;
22

33
public class UtilityName
44
{
5-
public const string AudioHandler = "audio-handler";
5+
public const string AudioHandler = "audio.audio-handler";
66
}

src/Plugins/BotSharp.Plugin.AudioHandler/Functions/HandleAudioRequestFn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace BotSharp.Plugin.AudioHandler.Functions;
55

66
public class HandleAudioRequestFn : IFunctionCallback
77
{
8-
public string Name => "handle_audio_request";
8+
public string Name => "util-audio-handle_audio_request";
99
public string Indication => "Handling audio request";
1010

1111
private readonly IServiceProvider _serviceProvider;

src/Plugins/BotSharp.Plugin.AudioHandler/Hooks/AudioHandlerUtilityHook.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ namespace BotSharp.Plugin.AudioHandler.Hooks;
22

33
public class AudioHandlerUtilityHook : IAgentUtilityHook
44
{
5-
private const string HANDLER_AUDIO = "handle_audio_request";
5+
private const string PREFIX = "util-audio-";
6+
private const string HANDLER_AUDIO = $"{PREFIX}handle_audio_request";
67

78
public void AddUtilities(List<AgentUtility> utilities)
89
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "handle_audio_request",
2+
"name": "util-audio-handle_audio_request",
33
"description": "If the user requests to transcribe or summarize audio content, you need to call this function to transcribe the audio content to raw texts or provide sunmmary based on raw texts transcribed from audio",
44
"parameters": {
55
"type": "object",

src/Plugins/BotSharp.Plugin.AudioHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/handle_audio_request.fn.liquid

Lines changed: 0 additions & 1 deletion
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please call util-audio-handle_audio_request if user wants to transcribe or summarize the content of a audio file.

src/Plugins/BotSharp.Plugin.EmailHandler/BotSharp.Plugin.EmailHandler.csproj

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

1313
<ItemGroup>
14-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_reader.json" />
15-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_sender.json" />
16-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_sender.fn.liquid" />
17-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid" />
18-
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_attachment_prompt.liquid" />
14+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-email-handle_email_reader.json" />
15+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-email-handle_email_sender.json" />
16+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-email-handle_email_sender.fn.liquid" />
17+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-email-handle_email_reader.fn.liquid" />
1918
</ItemGroup>
2019

2120
<ItemGroup>
22-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_reader.json">
21+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-email-handle_email_reader.json">
2322
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2423
</Content>
25-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_sender.json">
24+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-email-handle_email_sender.json">
2625
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2726
</Content>
28-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_sender.fn.liquid">
27+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-email-handle_email_sender.fn.liquid">
2928
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3029
</Content>
31-
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid">
30+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-email-handle_email_reader.fn.liquid">
3231
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3332
</Content>
3433
</ItemGroup>
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
1+
namespace BotSharp.Plugin.EmailHandler.Enums;
62

7-
namespace BotSharp.Plugin.EmailHandler.Enums
3+
public class UtilityName
84
{
9-
public class UtilityName
10-
{
11-
public const string EmailHandler = "email-handler";
12-
}
5+
public const string EmailHandler = "email.email-handler";
136
}

0 commit comments

Comments
 (0)