This commit is contained in:
Jicheng Lu 2025-09-26 19:21:08 -05:00
parent 2f9183f7d2
commit 0aa633787a
9 changed files with 28 additions and 14 deletions

View file

@ -73,7 +73,7 @@
<PackageVersion Include="Sdcb.PaddleOCR" Version="2.7.0.1" />
<PackageVersion Include="Sdcb.PaddleOCR.Models.LocalV3" Version="2.7.0.1" />
<PackageVersion Include="System.Drawing.Common" Version="8.0.14" />
<PackageVersion Include="pythonnet" Version="3.0.4" />
<PackageVersion Include="pythonnet" Version="3.0.5" />
<PackageVersion Include="Qdrant.Client" Version="1.15.0" />
<PackageVersion Include="Selenium.WebDriver" Version="4.27.0" />
<PackageVersion Include="HtmlAgilityPack" Version="1.12.0" />

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(TargetFramework)</TargetFramework>
@ -11,15 +11,19 @@
</PropertyGroup>
<ItemGroup>
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\python_interpreter.json" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\python_interpreter.fn.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-code-python_interpreter.json" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-code-python_interpreter.fn.liquid" />
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-code-python_generate_instruction.liquid" />
</ItemGroup>
<ItemGroup>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\python_interpreter.json">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\util-code-python_interpreter.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\python_interpreter.fn.liquid">
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-code-python_interpreter.fn.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\util-code-python_generate_instruction.liquid">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

View file

@ -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<PyInterpretationFn> _logger;
public PyInterpretationFn(
IServiceProvider services,
ILogger<PyInterpretationFn> logger)
{
_services = services;
_logger = logger;
}
public async Task<bool> Execute(RoleDialogModel message)
{

View file

@ -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<AgentUtility> 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"
}
]
};

View file

@ -37,6 +37,7 @@
<ProjectReference Include="..\..\tests\BotSharp.Plugin.PizzaBot\BotSharp.Plugin.PizzaBot.csproj" />
<ProjectReference Include="..\BotSharp.ServiceDefaults\BotSharp.ServiceDefaults.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.ExcelHandler\BotSharp.Plugin.ExcelHandler.csproj" />
<ProjectReference Include="..\Plugins\BotSharp.Plugin.PythonInterpreter\BotSharp.Plugin.PythonInterpreter.csproj" />
</ItemGroup>
<ItemGroup Condition="$(SolutionName)==BotSharp">

View file

@ -620,7 +620,8 @@
"BotSharp.Plugin.AudioHandler",
"BotSharp.Plugin.ExcelHandler",
"BotSharp.Plugin.SqlDriver",
"BotSharp.Plugin.TencentCos"
"BotSharp.Plugin.TencentCos",
"BotSharp.Plugin.PythonInterpreter"
]
}
}