mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-15 21:28:27 +00:00
Added a button which ends an exercise of the test situation of the BeyondFacts Lab
This commit is contained in:
8 files changed
+73
-1
No files matched your search
@@ -16,4 +16,5 @@
|
||||
AllowsAttachments="false"
|
||||
ShowsContextWindow="true"
|
||||
SystemPromptForCountAsync="@this.systemPromptForCountAsync"
|
||||
ContextVersion="@this.ContextVersion"/>
|
||||
ContextVersion="@this.ContextVersion"
|
||||
QuickMessage="@this.QuickMessage"/>
|
||||
@@ -109,6 +109,14 @@ public partial class BflChat : MSGComponentBase
|
||||
_ => TA("Delete this conversation and start it over?")
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button with which the person ends an exercise of the step "Test situation" and asks for its evaluation,
|
||||
/// see Prompts/steps/06-test.md; the other chats have none.
|
||||
/// </summary>
|
||||
private EmbeddedChatQuickMessage? QuickMessage => this.Location is BflStepThreadLocation { Step: BflStep.TEST_SITUATION }
|
||||
? new(T("End and evaluate the exercise"), AppIcons.END_EXERCISE, T("I would like to end the exercise now and get its evaluation."), TA("This button ends the exercise, and the lab evaluates it. While the lab simulates people, it gives feedback only then; write 'Pause' to get brief feedback in between."))
|
||||
: null;
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
@@ -31,6 +31,10 @@ Nutze für die Fragen, was die Person über ihre Kernthesen, Unsicherheiten und
|
||||
|
||||
Mit generischen Gegenübern: Erkläre in zwei Sätzen den Ablauf und nenne Art und Schwierigkeit, mit denen du beginnst. Stelle dann die erste kritische Frage.
|
||||
|
||||
### Übung beenden
|
||||
|
||||
Unter dem Eingabefeld hat die Person einen Button, der die Übung beendet: Er sendet in der Sprache der App die Bitte, die Übung zu beenden und auszuwerten. Diese Bitte, oder dieselbe in eigenen Worten, beendet die Übung; folge dann „Nach einer Übung“.
|
||||
|
||||
### Nach einer Übung
|
||||
|
||||
Hat die Person einige Runden gespielt oder möchte sie aufhören, frage: „Ändert sich Ihre Position, ihre Begründung oder nur ihre Darstellung?“ und „Was hat Ihre Reaktion geprägt, und möchten Sie an Ihrer Antwort oder Position etwas ändern?“ Weise darauf hin, dass sie zu „Werte und Perspektiven“ zurückkehren kann.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace AIStudio.Chat.Embedded;
|
||||
|
||||
/// <summary>
|
||||
/// A message which the user of an embedded chat sends with one click, such as asking for the evaluation at the end of
|
||||
/// an exercise.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The message goes into the chat as the user's own and stays visible there, so that the conversation reads the same
|
||||
/// whether the user clicked or typed it. It is written in the language of the app; the model reads it like any other
|
||||
/// message, so its prompt names what the message asks for, not its words.
|
||||
/// </remarks>
|
||||
/// <param name="Label">The label of the button.</param>
|
||||
/// <param name="Icon">The icon of the button.</param>
|
||||
/// <param name="Message">The message the button sends.</param>
|
||||
/// <param name="Hint">What the chat says beside the button, such as when to use it; empty for nothing.</param>
|
||||
public sealed record EmbeddedChatQuickMessage(string Label, string Icon, string Message, string Hint);
|
||||
@@ -82,6 +82,10 @@ else
|
||||
{
|
||||
<AttachDocuments Name="File Attachments" DocumentPaths="@this.attachments" DocumentPathsChanged="@this.AttachmentsChanged" CatchAllDocuments="true" UseSmallForm="true" ShowMediaStatus="false" Provider="@this.Provider" AllowedFileTypes="@this.AllowedFileTypes" Disabled="@(!this.CanSend)"/>
|
||||
}
|
||||
@if (this.QuickMessage is { } quickMessage && this.conversation.HasAnswer)
|
||||
{
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Primary" StartIcon="@quickMessage.Icon" OnClick="@this.SendQuickMessageAsync" Disabled="@(!this.CanSend)">@quickMessage.Label</MudButton>
|
||||
}
|
||||
@if (this.IsRunning)
|
||||
{
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@AppIcons.STOP" OnClick="@this.CancelAsync">@T("Stop")</MudButton>
|
||||
@@ -91,5 +95,9 @@ else
|
||||
<MudButton StartIcon="@AppIcons.RESET" OnClick="@this.ResetAsync" Disabled="@this.IsRunning">@T("Start over")</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
@if (this.QuickMessage is { Hint.Length: > 0 } hintedMessage && this.conversation.HasAnswer)
|
||||
{
|
||||
<MudText Typo="Typo.caption" Class="d-block mt-1">@hintedMessage.Hint</MudText>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,13 @@ public partial class EmbeddedChat : MSGComponentBase
|
||||
[Parameter]
|
||||
public string ExportFileName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a message the user sends with one click once the model has answered, such as asking for the
|
||||
/// evaluation at the end of an exercise; null for none.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EmbeddedChatQuickMessage? QuickMessage { get; set; }
|
||||
|
||||
[Inject]
|
||||
private EmbeddedChatService ChatService { get; init; } = null!;
|
||||
|
||||
@@ -425,6 +432,18 @@ public partial class EmbeddedChat : MSGComponentBase
|
||||
await this.ChatService.SendAsync(this.ChatId, this.RequestOf(message));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends the message of the button, see QuickMessage, as if the user had written it. What the user typed meanwhile
|
||||
/// stays in the field.
|
||||
/// </summary>
|
||||
private async Task SendQuickMessageAsync()
|
||||
{
|
||||
if (this.QuickMessage is not { } quickMessage || !this.CanSend)
|
||||
return;
|
||||
|
||||
await this.ChatService.SendAsync(this.ChatId, this.RequestOf(new ContentText { Text = quickMessage.Message }));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lets the model open the conversation, see StartRequest.
|
||||
/// </summary>
|
||||
|
||||
@@ -413,6 +413,9 @@ public static class AppIcons
|
||||
/// <summary>Enables an item, such as an installed assistant plugin, or shows that it is enabled.</summary>
|
||||
public const string ENABLE = LucideIcons.TOGGLE_RIGHT;
|
||||
|
||||
/// <summary>Ends an exercise and asks for its evaluation, such as in the test situation of the BeyondFacts Lab.</summary>
|
||||
public const string END_EXERCISE = LucideIcons.FLAG;
|
||||
|
||||
/// <summary>Stands for encrypting a connection, such as the transport security of a mailbox.</summary>
|
||||
public const string ENCRYPTION = LucideIcons.LOCK_KEYHOLE;
|
||||
|
||||
|
||||
@@ -140,6 +140,19 @@ public sealed class BflSimulationPromptTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ThePromptOfTheTestSituationTellsHowTheButtonEndsAnExercise()
|
||||
{
|
||||
var step = (await BflPromptLibrary.ReadAsync(BflPromptLibrary.StepPath(BflStep.TEST_SITUATION))).ReplaceLineEndings("\n");
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(step, Does.Contain("\n### Übung beenden\n"));
|
||||
Assert.That(step, Does.Contain("folge dann „Nach einer Übung“"));
|
||||
Assert.That(step, Does.Contain("\n### Nach einer Übung\n"));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheServiceLoadsWhomOnlyTheTestSituationPlays()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user