2024-06-24 18:03:05 +00:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.OpenAPI.ViewModels.Instructs;
|
|
|
|
|
|
2024-08-26 22:24:07 +00:00
|
|
|
public class ImageGenerationViewModel : InstructBaseViewModel
|
2024-06-24 18:03:05 +00:00
|
|
|
{
|
2024-07-01 16:03:42 +00:00
|
|
|
[JsonPropertyName("images")]
|
2024-06-24 18:03:05 +00:00
|
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
2024-07-01 16:03:42 +00:00
|
|
|
public IEnumerable<ImageViewModel> Images { get; set; } = new List<ImageViewModel>();
|
2024-06-24 18:03:05 +00:00
|
|
|
}
|
2024-07-01 16:03:42 +00:00
|
|
|
|
|
|
|
|
public class ImageViewModel
|
|
|
|
|
{
|
|
|
|
|
[JsonPropertyName("image_url")]
|
|
|
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
|
|
|
public string? ImageUrl { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonPropertyName("image_data")]
|
|
|
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
|
|
|
|
public string? ImageData { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonPropertyName("description")]
|
|
|
|
|
public string Description { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public static ImageViewModel ToViewModel(ImageGeneration image)
|
|
|
|
|
{
|
|
|
|
|
return new ImageViewModel
|
|
|
|
|
{
|
|
|
|
|
ImageUrl = image.ImageUrl,
|
|
|
|
|
ImageData = image.ImageData,
|
|
|
|
|
Description = image.Description
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|