Skip to content

Commit d9ee186

Browse files
committed
feat: update With ITelemetryService
1 parent 3e8e6f9 commit d9ee186

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Infrastructure/BotSharp.Core/Routing/Executor/FunctionExecutorFactory.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using BotSharp.Abstraction.Diagnostics.Telemetry;
12
using BotSharp.Abstraction.Functions;
23
using BotSharp.Abstraction.Routing.Executor;
34

@@ -7,10 +8,12 @@ internal class FunctionExecutorFactory
78
{
89
public static IFunctionExecutor? Create(IServiceProvider services, string functionName, Agent agent)
910
{
11+
ITelemetryService telemetryService = services.GetRequiredService<ITelemetryService>();
12+
1013
var functionCall = services.GetServices<IFunctionCallback>().FirstOrDefault(x => x.Name == functionName);
1114
if (functionCall != null)
1215
{
13-
return new FunctionCallbackExecutor(functionCall);
16+
return new FunctionCallbackExecutor( telemetryService,functionCall);
1417
}
1518

1619
var functions = (agent?.Functions ?? []).Concat(agent?.SecondaryFunctions ?? []);
@@ -23,7 +26,7 @@ internal class FunctionExecutorFactory
2326
var mcpServerId = agent?.McpTools?.Where(x => x.Functions.Any(y => y.Name == funcDef?.Name))?.FirstOrDefault()?.ServerId;
2427
if (!string.IsNullOrWhiteSpace(mcpServerId))
2528
{
26-
return new McpToolExecutor(services, mcpServerId, functionName);
29+
return new McpToolExecutor(services, telemetryService, mcpServerId, functionName);
2730
}
2831

2932
return null;

src/Plugins/BotSharp.Plugin.GiteeAI/Providers/Chat/ChatCompletionProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using BotSharp.Abstraction.Agents.Constants;
2-
using BotSharp.Abstraction.Diagnostics;
2+
using BotSharp.Abstraction.Diagnostics.Telemetry;
33
using BotSharp.Abstraction.Files;
4-
using Microsoft.AspNetCore.Cors.Infrastructure;
54
using Microsoft.Extensions.Logging;
65
using OpenAI.Chat;
76
using System.Diagnostics;

0 commit comments

Comments
 (0)