mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-04 20:22:56 +00:00
Allow us to hide some messages from the user
This commit is contained in:
parent
64d8a0fd5f
commit
0c19146f05
@ -201,13 +201,14 @@ public abstract partial class AssistantBase : ComponentBase, IMessageBusReceiver
|
|||||||
return chatId;
|
return chatId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DateTimeOffset AddUserRequest(string request)
|
protected DateTimeOffset AddUserRequest(string request, bool hideContentFromUser = false)
|
||||||
{
|
{
|
||||||
var time = DateTimeOffset.Now;
|
var time = DateTimeOffset.Now;
|
||||||
this.chatThread!.Blocks.Add(new ContentBlock
|
this.chatThread!.Blocks.Add(new ContentBlock
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
ContentType = ContentType.TEXT,
|
ContentType = ContentType.TEXT,
|
||||||
|
HideFromUser = hideContentFromUser,
|
||||||
Role = ChatRole.USER,
|
Role = ChatRole.USER,
|
||||||
Content = new ContentText
|
Content = new ContentText
|
||||||
{
|
{
|
||||||
|
@ -18,10 +18,15 @@ public class ContentBlock
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The content of the block.
|
/// The content of the block.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IContent? Content { get; init; } = null;
|
public IContent? Content { get; init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The role of the content block in the chat thread, e.g., user, AI, etc.
|
/// The role of the content block in the chat thread, e.g., user, AI, etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ChatRole Role { get; init; } = ChatRole.NONE;
|
public ChatRole Role { get; init; } = ChatRole.NONE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should the content block be hidden from the user?
|
||||||
|
/// </summary>
|
||||||
|
public bool HideFromUser { get; set; }
|
||||||
}
|
}
|
@ -22,7 +22,10 @@
|
|||||||
{
|
{
|
||||||
foreach (var block in this.chatThread.Blocks.OrderBy(n => n.Time))
|
foreach (var block in this.chatThread.Blocks.OrderBy(n => n.Time))
|
||||||
{
|
{
|
||||||
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content"/>
|
@if (!block.HideFromUser)
|
||||||
|
{
|
||||||
|
<ContentBlockComponent Role="@block.Role" Type="@block.ContentType" Time="@block.Time" Content="@block.Content"/>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</ChildContent>
|
</ChildContent>
|
||||||
|
Loading…
Reference in New Issue
Block a user