Refactored image content type

This commit is contained in:
Thorsten Sommer 2025-02-10 16:11:27 +01:00
parent 017e6eb9e7
commit 53dd6a6144
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 17 additions and 6 deletions

View File

@ -78,9 +78,9 @@
break;
case ContentType.IMAGE:
if (this.Content is ContentImage imageContent)
if (this.Content is ContentImage { SourceType: ContentImageSource.URL or ContentImageSource.LOCAL_PATH } imageContent)
{
<MudImage Src="@imageContent.URL"/>
<MudImage Src="@imageContent.Source"/>
}
break;

View File

@ -37,12 +37,15 @@ public sealed class ContentImage : IContent
#endregion
/// <summary>
/// The URL of the image.
/// The type of the image source.
/// </summary>
public string URL { get; set; } = string.Empty;
/// <remarks>
/// Is the image source a URL, a local file path, a base64 string, etc.?
/// </remarks>
public required ContentImageSource SourceType { get; init; }
/// <summary>
/// The local path of the image.
/// The image source.
/// </summary>
public string LocalPath { get; set; } = string.Empty;
public required string Source { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace AIStudio.Chat;
public enum ContentImageSource
{
URL,
LOCAL_PATH,
BASE64,
}