From 0aa633787a18ec7c8c4d3d46753bab39eac08765 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 26 Sep 2025 19:21:08 -0500 Subject: [PATCH] init --- Directory.Packages.props | 2 +- .../BotSharp.Plugin.PythonInterpreter.csproj | 14 +++++++++----- ...InterpretationFn.cs => PyInterpretationFn.cs} | 16 ++++++++++++---- .../Hooks/InterpreterUtilityHook.cs | 6 +++--- ...er.json => util-code-python_interpreter.json} | 0 .../util-code-python_generate_instruction.liquid | 0 ...id => util-code-python_interpreter.fn.liquid} | 0 src/WebStarter/WebStarter.csproj | 1 + src/WebStarter/appsettings.json | 3 ++- 9 files changed, 28 insertions(+), 14 deletions(-) rename src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/{InterpretationFn.cs => PyInterpretationFn.cs} (75%) rename src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/{python_interpreter.json => util-code-python_interpreter.json} (100%) create mode 100644 src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-code-python_generate_instruction.liquid rename src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/{python_interpreter.fn.liquid => util-code-python_interpreter.fn.liquid} (100%) diff --git a/Directory.Packages.props b/Directory.Packages.props index de3730f0..d5d3954f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -73,7 +73,7 @@ - + diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/BotSharp.Plugin.PythonInterpreter.csproj b/src/Plugins/BotSharp.Plugin.PythonInterpreter/BotSharp.Plugin.PythonInterpreter.csproj index 391593b3..ab15acf7 100644 --- a/src/Plugins/BotSharp.Plugin.PythonInterpreter/BotSharp.Plugin.PythonInterpreter.csproj +++ b/src/Plugins/BotSharp.Plugin.PythonInterpreter/BotSharp.Plugin.PythonInterpreter.csproj @@ -1,4 +1,4 @@ - + $(TargetFramework) @@ -11,15 +11,19 @@ - - + + + - + PreserveNewest - + + PreserveNewest + + PreserveNewest diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/InterpretationFn.cs b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyInterpretationFn.cs similarity index 75% rename from src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/InterpretationFn.cs rename to src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyInterpretationFn.cs index b12cb739..818340b9 100644 --- a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/InterpretationFn.cs +++ b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Functions/PyInterpretationFn.cs @@ -8,13 +8,21 @@ using System.Threading.Tasks; namespace BotSharp.Plugin.PythonInterpreter.Functions; -public class InterpretationFn : IFunctionCallback +public class PyInterpretationFn : IFunctionCallback { - public string Name => "python_interpreter"; - public string Indication => "Interpreting python code"; + public string Name => "util-code-python_interpreter"; + public string Indication => "Executing python code"; private readonly IServiceProvider _services; - private readonly ILogger _logger; + private readonly ILogger _logger; + + public PyInterpretationFn( + IServiceProvider services, + ILogger logger) + { + _services = services; + _logger = logger; + } public async Task Execute(RoleDialogModel message) { diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Hooks/InterpreterUtilityHook.cs b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Hooks/InterpreterUtilityHook.cs index 7b644be2..97a0f482 100644 --- a/src/Plugins/BotSharp.Plugin.PythonInterpreter/Hooks/InterpreterUtilityHook.cs +++ b/src/Plugins/BotSharp.Plugin.PythonInterpreter/Hooks/InterpreterUtilityHook.cs @@ -2,7 +2,7 @@ namespace BotSharp.Plugin.PythonInterpreter.Hooks; public class InterpreterUtilityHook : IAgentUtilityHook { - private static string FUNCTION_NAME = "python_interpreter"; + private const string PY_INTERPRETER_FN = "util-code-python_interpreter"; public void AddUtilities(List utilities) { @@ -13,8 +13,8 @@ public class InterpreterUtilityHook : IAgentUtilityHook Items = [ new UtilityItem { - FunctionName = FUNCTION_NAME, - TemplateName = $"{FUNCTION_NAME}.fn" + FunctionName = PY_INTERPRETER_FN, + TemplateName = $"{PY_INTERPRETER_FN}.fn" } ] }; diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/python_interpreter.json b/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-code-python_interpreter.json similarity index 100% rename from src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/python_interpreter.json rename to src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-code-python_interpreter.json diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-code-python_generate_instruction.liquid b/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-code-python_generate_instruction.liquid new file mode 100644 index 00000000..e69de29b diff --git a/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/python_interpreter.fn.liquid b/src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-code-python_interpreter.fn.liquid similarity index 100% rename from src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/python_interpreter.fn.liquid rename to src/Plugins/BotSharp.Plugin.PythonInterpreter/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-code-python_interpreter.fn.liquid diff --git a/src/WebStarter/WebStarter.csproj b/src/WebStarter/WebStarter.csproj index 6e017615..e5b90ddd 100644 --- a/src/WebStarter/WebStarter.csproj +++ b/src/WebStarter/WebStarter.csproj @@ -37,6 +37,7 @@ + diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 59d7d3f5..81ac7091 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -620,7 +620,8 @@ "BotSharp.Plugin.AudioHandler", "BotSharp.Plugin.ExcelHandler", "BotSharp.Plugin.SqlDriver", - "BotSharp.Plugin.TencentCos" + "BotSharp.Plugin.TencentCos", + "BotSharp.Plugin.PythonInterpreter" ] } }