using System.Text.Json.Serialization; using AIStudio.Provider; using AIStudio.Settings; namespace AIStudio.Chat; /// /// The interface for any content in the chat. /// [JsonDerivedType(typeof(ContentText), typeDiscriminator: "text")] [JsonDerivedType(typeof(ContentImage), typeDiscriminator: "image")] public interface IContent { /// /// Do we need to wait for the remote, i.e., the AI, to process the related request? /// Does not indicate that the stream is finished; it only indicates that we are /// waiting for the first response, i.e., wait for the remote to pick up the request. /// [JsonIgnore] public bool InitialRemoteWait { get; set; } /// /// Indicates whether the content is streaming right now. False, if the content is /// either static or the stream has finished. /// [JsonIgnore] public bool IsStreaming { get; set; } /// /// An action that is called when the content was changed during streaming. /// [JsonIgnore] public Func StreamingEvent { get; set; } /// /// An action that is called when the streaming is done. /// [JsonIgnore] public Func StreamingDone { get; set; } /// /// Uses the provider to create the content. /// public Task CreateFromProviderAsync(IProvider provider, SettingsManager settings, Model chatModel, ChatThread chatChatThread, CancellationToken token = default); }