Improved null handling

This commit is contained in:
Thorsten Sommer 2026-02-13 21:34:31 +01:00
parent 3202b8b629
commit db295e5259
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -7,7 +7,7 @@ namespace AIStudio.Provider.OpenAI;
/// <param name="Delta">The delta content of the response.</param>
public record ResponsesDeltaStreamLine(
string Type,
string Delta) : IResponseStreamLine
string? Delta) : IResponseStreamLine
{
#region Implementation of IResponseStreamLine
@ -15,7 +15,7 @@ public record ResponsesDeltaStreamLine(
public bool ContainsContent() => this.Delta is not null;
/// <inheritdoc />
public ContentStreamChunk GetContent() => new(this.Delta, this.GetSources());
public ContentStreamChunk GetContent() => new(this.Delta ?? string.Empty, this.GetSources());
//
// Please note that there are multiple options where LLM providers might stream sources:
@ -36,4 +36,4 @@ public record ResponsesDeltaStreamLine(
public IList<ISource> GetSources() => [];
#endregion
}
}