diff --git a/DysonNetwork.Insight/Thought/ThoughtController.cs b/DysonNetwork.Insight/Thought/ThoughtController.cs index 6077014..cb8a9da 100644 --- a/DysonNetwork.Insight/Thought/ThoughtController.cs +++ b/DysonNetwork.Insight/Thought/ThoughtController.cs @@ -141,7 +141,7 @@ public class ThoughtController(ThoughtProvider provider, ThoughtService service) break; case ThinkingMessagePartType.FunctionResult: var resultObject = part.FunctionResult!.Result; - var resultString = resultObject is string s ? s : JsonSerializer.Serialize(resultObject); + var resultString = resultObject as string ?? JsonSerializer.Serialize(resultObject); functionResults.Add(new FunctionResultContent( callId: part.FunctionResult.CallId, functionName: part.FunctionResult.FunctionName, diff --git a/DysonNetwork.Insight/Thought/ThoughtProvider.cs b/DysonNetwork.Insight/Thought/ThoughtProvider.cs index 040b2c0..36555e0 100644 --- a/DysonNetwork.Insight/Thought/ThoughtProvider.cs +++ b/DysonNetwork.Insight/Thought/ThoughtProvider.cs @@ -73,24 +73,21 @@ public class ThoughtProvider throw new IndexOutOfRangeException("Unknown thinking provider: " + ModelProviderType); } + // Add gRPC clients for Thought Plugins + builder.Services.AddServiceDiscoveryCore(); + builder.Services.AddServiceDiscovery(); + builder.Services.AddAccountService(); + builder.Services.AddSphereService(); + + builder.Plugins.AddFromObject(new SnAccountKernelPlugin(_accountClient)); + builder.Plugins.AddFromObject(new SnPostKernelPlugin(_postClient)); + return builder.Build(); } [Experimental("SKEXP0050")] private void InitializeHelperFunctions() { - var accountPlugin = new SnAccountKernelPlugin(_accountClient); - var postPlugin = new SnPostKernelPlugin(_postClient); - - // Add Solar Network tools plugin - Kernel.ImportPluginFromFunctions("solar_network", [ - KernelFunctionFactory.CreateFromMethod(accountPlugin.GetAccount), - KernelFunctionFactory.CreateFromMethod(accountPlugin.GetAccountByName), - KernelFunctionFactory.CreateFromMethod(postPlugin.GetPost), - KernelFunctionFactory.CreateFromMethod(postPlugin.ListPosts), - KernelFunctionFactory.CreateFromMethod(postPlugin.ListPostsWithinTime) - ]); - // Add web search plugins if configured var bingApiKey = _configuration.GetValue("Thinking:BingApiKey"); if (!string.IsNullOrEmpty(bingApiKey))