From 6a0153db28b12a17abaf8ebd06f694b7fb81ba86 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 6 Oct 2025 10:57:18 -0500 Subject: [PATCH] add code script to context --- .../Instructs/Models/CodeInstructContext.cs | 1 + .../Instructs/Services/InstructService.Execute.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/CodeInstructContext.cs b/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/CodeInstructContext.cs index 0cb3910b..2be0368f 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/CodeInstructContext.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Instructs/Models/CodeInstructContext.cs @@ -2,5 +2,6 @@ namespace BotSharp.Abstraction.Instructs.Models; public class CodeInstructContext { + public string CodeScript { get; set; } public List Arguments { get; set; } = []; } diff --git a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs index 7be841f5..11ff7518 100644 --- a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs +++ b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs @@ -205,6 +205,7 @@ public partial class InstructService var context = new CodeInstructContext { + CodeScript = codeScript, Arguments = arguments }; @@ -225,7 +226,7 @@ public partial class InstructService } // Run code script - var result = await codeInterpreter.RunCode(codeScript, options: new() + var result = await codeInterpreter.RunCode(context.CodeScript, options: new() { Arguments = context.Arguments });