Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public async Task<InstructResult> InstructCompletion([FromRoute] string agentId,
{
var state = _services.GetRequiredService<IConversationStateService>();
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)
Expand All @@ -33,7 +34,8 @@ public async Task<InstructResult> 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<IInstructService>();
var result = await instructor.Execute(agentId,
Expand Down
Loading