diff --git a/src/Infrastructure/BotSharp.Abstraction/Files/Models/InstructFileModel.cs b/src/Infrastructure/BotSharp.Abstraction/Files/Models/InstructFileModel.cs index 4d04a2fc7..76de57d68 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Files/Models/InstructFileModel.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Files/Models/InstructFileModel.cs @@ -22,4 +22,17 @@ public class InstructFileModel : FileBase [JsonPropertyName("content_type")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? ContentType { get; set; } + + public override string ToString() + { + if (!string.IsNullOrEmpty(FileUrl)) + { + return FileUrl; + } + else if (!string.IsNullOrEmpty(FileData)) + { + return FileData.SubstringMax(20); + } + return string.Empty; + } } diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.cs index c51a26fa3..71b9c7cde 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/Instruct/InstructModeController.cs @@ -24,6 +24,7 @@ public async Task InstructCompletion([FromRoute] string agentId, { var state = _services.GetRequiredService(); input.States.ForEach(x => state.SetState(x.Key, x.Value, activeRounds: x.ActiveRounds, source: StateSource.External)); + state.SetState("provider", input.Provider, source: StateSource.External) .SetState("model", input.Model, source: StateSource.External) .SetState("model_id", input.ModelId, source: StateSource.External) @@ -33,7 +34,8 @@ public async Task InstructCompletion([FromRoute] string agentId, .SetState("channel", input.Channel, source: StateSource.External) .SetState("code_options", input.CodeOptions, source: StateSource.External) .SetState("file_options", input.FileOptions, source: StateSource.External) - .SetState("file_count", !input.Files.IsNullOrEmpty() ? input.Files.Count : (int?)null, source: StateSource.External); + .SetState("file_count", input.Files?.Count, source: StateSource.External) + .SetState("file_urls", input.Files?.Select(p => p.ToString()), source: StateSource.External); var instructor = _services.GetRequiredService(); var result = await instructor.Execute(agentId,