mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-15 12:08:27 +00:00
Moved the chats of the BeyondFacts Lab to the embedded chat of assistants (#1203)
This commit is contained in:
1 parent
dc97db256e
commit
cb54ad297d
27 files changed
+1023
-743
No files matched your search
@@ -4,13 +4,15 @@ using AIStudio.Chat.Embedded;
|
||||
namespace AIStudio.Tests.Chat.Embedded;
|
||||
|
||||
/// <summary>
|
||||
/// Checks when an embedded chat sends the message it opens with.
|
||||
/// Checks when an embedded chat sends the message it opens with, and when it offers to let the model begin.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public sealed class EmbeddedChatOpeningTests
|
||||
{
|
||||
private static readonly ContentText OPENING_MESSAGE = new() { Text = "What is new today?" };
|
||||
|
||||
private const string START_REQUEST = "Open the conversation with your first message.";
|
||||
|
||||
[Test]
|
||||
public void AnEmptyChatSendsItsOpeningMessage()
|
||||
{
|
||||
@@ -61,6 +63,57 @@ public sealed class EmbeddedChatOpeningTests
|
||||
Assert.That(EmbeddedChatOpening.SendsNow(OPENING_MESSAGE, conversation, wasSent: false), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnEmptyChatOffersToBegin()
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, Conversation()), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWithoutStartRequestOffersNothing()
|
||||
{
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(null, Conversation()), Is.False);
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(" ", Conversation()), Is.False);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWhoseConversationBeganOffersNothing()
|
||||
{
|
||||
var conversation = Conversation();
|
||||
conversation.Thread!.Blocks.Add(new ContentBlock { Role = ChatRole.AI, ContentType = ContentType.TEXT, Content = new ContentText { Text = "Hello, what do you prepare?" } });
|
||||
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, conversation), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWithOnlyAHiddenRequestStillOffersToBegin()
|
||||
{
|
||||
// E.g., the model failed to answer the request which lets it begin:
|
||||
var conversation = Conversation();
|
||||
conversation.Thread!.Blocks.Add(new ContentBlock { Role = ChatRole.USER, ContentType = ContentType.TEXT, Content = new ContentText { Text = START_REQUEST }, HideFromUser = true });
|
||||
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, conversation), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AChatWhichLoadsRunsOrCannotBeOpenedOffersNothing()
|
||||
{
|
||||
var running = Conversation();
|
||||
running.IsRunning = true;
|
||||
var unavailable = Conversation();
|
||||
unavailable.Thread = null;
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, null), Is.False);
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, running), Is.False);
|
||||
Assert.That(EmbeddedChatOpening.OffersStart(START_REQUEST, unavailable), Is.False);
|
||||
}
|
||||
}
|
||||
|
||||
private static EmbeddedConversation Conversation() => new()
|
||||
{
|
||||
ChatId = Guid.NewGuid(),
|
||||
|
||||
Reference in new issue
Block a user