Skip to content

Commit 6a0153d

Browse files
author
Jicheng Lu
committed
add code script to context
1 parent babb879 commit 6a0153d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Infrastructure/BotSharp.Abstraction/Instructs/Models/CodeInstructContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ namespace BotSharp.Abstraction.Instructs.Models;
22

33
public class CodeInstructContext
44
{
5+
public string CodeScript { get; set; }
56
public List<KeyValue> Arguments { get; set; } = [];
67
}

src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ await hook.OnResponseGenerated(new InstructResponseModel
205205

206206
var context = new CodeInstructContext
207207
{
208+
CodeScript = codeScript,
208209
Arguments = arguments
209210
};
210211

@@ -225,7 +226,7 @@ await hook.OnResponseGenerated(new InstructResponseModel
225226
}
226227

227228
// Run code script
228-
var result = await codeInterpreter.RunCode(codeScript, options: new()
229+
var result = await codeInterpreter.RunCode(context.CodeScript, options: new()
229230
{
230231
Arguments = context.Arguments
231232
});

0 commit comments

Comments
 (0)