diff --git a/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionResponseStreamLine.cs b/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionResponseStreamLine.cs index dc4f5f3d..73f93487 100644 --- a/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionResponseStreamLine.cs +++ b/app/MindWork AI Studio/Provider/OpenAI/ChatCompletionResponseStreamLine.cs @@ -9,10 +9,15 @@ namespace AIStudio.Provider.OpenAI; /// The model used for the response. /// The system fingerprint; together with the seed, this allows you to reproduce the response. /// The choices made by the AI. -public readonly record struct ChatCompletionResponseStreamLine(string Id, string Object, uint Created, string Model, string SystemFingerprint, IList Choices) : IResponseStreamLine +public record ChatCompletionResponseStreamLine(string Id, string Object, uint Created, string Model, string SystemFingerprint, IList Choices) : IResponseStreamLine { + public ChatCompletionResponseStreamLine() : this(string.Empty, string.Empty, 0, string.Empty, string.Empty, []) + { + + } + /// - public bool ContainsContent() => this != default && this.Choices.Count > 0; + public bool ContainsContent() => this.Choices.Count > 0; /// public ContentStreamChunk GetContent() => new(this.Choices[0].Delta.Content, []); @@ -23,10 +28,20 @@ public readonly record struct ChatCompletionResponseStreamLine(string Id, string /// /// The index of the choice. /// The delta text of the choice. -public readonly record struct Choice(int Index, Delta Delta); +public record Choice(int Index, Delta Delta) +{ + public Choice() : this(0, new (string.Empty)) + { + } +} /// /// The delta text of a choice. /// /// The content of the delta text. -public readonly record struct Delta(string Content); \ No newline at end of file +public record Delta(string Content) +{ + public Delta() : this(string.Empty) + { + } +} \ No newline at end of file