AI-Studio/app/MindWork AI Studio/Chat/ContentImage.cs

59 lines
1.5 KiB
C#
Raw Normal View History

using System.Text.Json.Serialization;
2024-05-04 09:11:09 +00:00
using AIStudio.Provider;
namespace AIStudio.Chat;
/// <summary>
/// Represents an image inside the chat.
/// </summary>
public sealed class ContentImage : IContent, IImageSource
2024-05-04 09:11:09 +00:00
{
#region Implementation of IContent
/// <inheritdoc />
[JsonIgnore]
2025-05-24 17:11:28 +00:00
public bool InitialRemoteWait { get; set; }
2024-05-04 09:11:09 +00:00
/// <inheritdoc />
[JsonIgnore]
2025-05-24 17:11:28 +00:00
public bool IsStreaming { get; set; }
2024-05-04 09:11:09 +00:00
/// <inheritdoc />
[JsonIgnore]
2024-05-04 09:11:09 +00:00
public Func<Task> StreamingDone { get; set; } = () => Task.CompletedTask;
/// <inheritdoc />
[JsonIgnore]
2024-05-04 09:11:09 +00:00
public Func<Task> StreamingEvent { get; set; } = () => Task.CompletedTask;
/// <inheritdoc />
public Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastPrompt, ChatThread? chatChatThread, CancellationToken token = default)
2024-05-04 09:11:09 +00:00
{
throw new NotImplementedException();
}
2025-05-24 10:27:00 +00:00
/// <inheritdoc />
2025-05-24 17:11:28 +00:00
public IContent DeepClone() => new ContentImage
2025-05-24 10:27:00 +00:00
{
2025-05-24 17:11:28 +00:00
Source = this.Source,
InitialRemoteWait = this.InitialRemoteWait,
IsStreaming = this.IsStreaming,
SourceType = this.SourceType,
};
2024-05-04 09:11:09 +00:00
#endregion
/// <summary>
/// The type of the image source.
2024-05-04 09:11:09 +00:00
/// </summary>
/// <remarks>
/// Is the image source a URL, a local file path, a base64 string, etc.?
/// </remarks>
public required ContentImageSource SourceType { get; init; }
2024-05-04 09:11:09 +00:00
/// <summary>
/// The image source.
2024-05-04 09:11:09 +00:00
/// </summary>
public required string Source { get; set; }
2024-05-04 09:11:09 +00:00
}