You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/libs/CSharpToJsonSchema.Generators/Sources.Method.Tools.cs
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
usingCSharpToJsonSchema.Generators.Models;
1
+
usingCSharpToJsonSchema.Generators.Conversion;
2
+
usingCSharpToJsonSchema.Generators.Models;
2
3
usingH.Generators.Extensions;
3
4
usingMicrosoft.CodeAnalysis;
4
5
@@ -28,7 +29,7 @@ public static string GenerateFunctionToolClientImplementation(InterfaceData @int
28
29
namespace {@interface.Namespace}
29
30
{{
30
31
public partial class {extensionsClassName}
31
-
{{
32
+
{{
32
33
static {extensionsClassName}()
33
34
{{
34
35
AddAllTools();
@@ -66,14 +67,16 @@ public void AddTool(global::System.Delegate tool)
66
67
AvailableTools.Add(newTool);
67
68
if(Delegates.ContainsKey(name))
68
69
throw new global::System.Exception({"$\"Function {name} is already registered\""});
69
-
Delegates.Add(name, tool);
70
+
Delegates.Add(name, tool);
71
+
70
72
}}
71
73
72
74
public Tools(global::System.Delegate[] tools)
73
75
{{
74
-
foreach (var tool in tools)
76
+
for(int i = 0; i < tools.Length; i++)
75
77
{{
76
-
AddTool(tool);
78
+
var x = tools[i];
79
+
AddTool(x);
77
80
}}
78
81
}}
79
82
@@ -86,7 +89,7 @@ public Tools(global::System.Delegate[] tools)
86
89
{{
87
90
return (global::System.Collections.Generic.List<global::CSharpToJsonSchema.Tool>) (this.AvailableTools??= new global::System.Collections.Generic.List<global::CSharpToJsonSchema.Tool>());
0 commit comments