Files
AI-Studio/app/MindWork AI Studio/Chat/ContentBlock.cs
T

41 lines
1.2 KiB
C#
Raw Normal View History

2024-05-04 11:11:09 +02:00
namespace AIStudio.Chat;
/// <summary>
/// A block of content in a chat thread. Might be any type of content, e.g., text, image, voice, etc.
/// </summary>
2024-07-13 10:37:57 +02:00
public class ContentBlock
2024-05-04 11:11:09 +02:00
{
/// <summary>
/// Time when the content block was created.
/// </summary>
2024-07-13 10:37:57 +02:00
public DateTimeOffset Time { get; init; }
2024-05-04 11:11:09 +02:00
/// <summary>
/// Type of the content block, e.g., text, image, voice, etc.
/// </summary>
2024-07-13 10:37:57 +02:00
public ContentType ContentType { get; init; } = ContentType.NONE;
2024-05-04 11:11:09 +02:00
/// <summary>
/// The content of the block.
/// </summary>
2025-05-24 12:27:00 +02:00
public IContent? Content { get; set; }
2024-05-04 11:11:09 +02:00
/// <summary>
/// The role of the content block in the chat thread, e.g., user, AI, etc.
/// </summary>
2025-05-24 12:27:00 +02:00
public ChatRole Role { get; set; } = ChatRole.NONE;
2024-10-28 15:41:00 +01:00
/// <summary>
/// Should the content block be hidden from the user?
/// </summary>
2025-05-24 19:11:28 +02:00
public bool HideFromUser { get; init; }
2025-05-24 12:27:00 +02:00
2025-07-11 09:57:46 +02:00
public ContentBlock DeepClone(bool changeHideState = false, bool hideFromUser = true) => new()
2025-05-24 12:27:00 +02:00
{
2025-05-24 19:11:28 +02:00
Time = this.Time,
ContentType = this.ContentType,
Content = this.Content?.DeepClone(),
Role = this.Role,
2025-07-11 09:57:46 +02:00
HideFromUser = changeHideState ? hideFromUser : this.HideFromUser,
2025-05-24 19:11:28 +02:00
};
2024-05-04 11:11:09 +02:00
}