diff --git a/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/CodeInstructOptions.cs b/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/CodeInstructOptions.cs index 89684cfdf..2ea99275f 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/CodeInstructOptions.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/CodeInstructOptions.cs @@ -2,7 +2,15 @@ namespace BotSharp.Abstraction.Instructs.Options; public class CodeInstructOptions { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("processor")] public string? Processor { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("code_script_name")] public string? CodeScriptName { get; set; } + + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("arguments")] public List? Arguments { get; set; } } diff --git a/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/FileInstructOptions.cs b/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/FileInstructOptions.cs index bb575f49d..6e6ac1fd1 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/FileInstructOptions.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Instructs/Options/FileInstructOptions.cs @@ -2,5 +2,7 @@ namespace BotSharp.Abstraction.Instructs.Options; public class FileInstructOptions { + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("processor")] public string? Processor { 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 7885afa89..3556cabc6 100644 --- a/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs +++ b/src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Execute.cs @@ -125,7 +125,6 @@ public async Task Execute( Data = state.GetStates().ToDictionary(x => x.Key, x => (object)x.Value) }); result = fileResponse.Result.IfNullOrEmptyAs(string.Empty); - state.SetState("fileOptions", fileOptions.ConvertToString()); } else { diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs index cdb1dab49..dab28ca6b 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/InstructModeController.cs @@ -32,7 +32,9 @@ public async Task InstructCompletion([FromRoute] string agentId, .SetState("instruction", input.Instruction, source: StateSource.External) .SetState("input_text", input.Text, source: StateSource.External) .SetState("template_name", input.Template, source: StateSource.External) - .SetState("channel", input.Channel, source: StateSource.External); + .SetState("channel", input.Channel, source: StateSource.External) + .SetState("code_options", input.CodeOptions, source: StateSource.External) + .SetState("file_options", input.FileOptions, source: StateSource.External); var instructor = _services.GetRequiredService(); var result = await instructor.Execute(agentId,