mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 10:07:21 +00:00
Added a Send to menu to every chat message and kept restrictions when sending content on (#1124)
This commit is contained in:
1 parent
d06688ca08
commit
bf54b8cd0d
73 files changed
+1923
-390
No files matched your search
@@ -0,0 +1,64 @@
|
||||
using AIStudio.Tools;
|
||||
using AIStudio.Tools.AssistantLaunch;
|
||||
|
||||
namespace AIStudio.Tests.Tools.AssistantLaunch;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which destinations a component offers when the user sends content on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The assistants and the chat offer the same destinations, so they all ask the same place. An assistant
|
||||
/// which offered itself would take the content nowhere: its page is open already and does not pick it up.
|
||||
/// The components are written out in full, since a short name would find a namespace of this assembly first.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class AssistantLaunchServiceTests
|
||||
{
|
||||
[Test]
|
||||
public void AnAssistantNeverOffersItself()
|
||||
{
|
||||
var destinations = AssistantLaunchService.SelectDestinations(AIStudio.Tools.Components.TRANSLATION_ASSISTANT, _ => true);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(destinations, Does.Not.Contain(AIStudio.Tools.Components.TRANSLATION_ASSISTANT));
|
||||
Assert.That(destinations, Does.Contain(AIStudio.Tools.Components.SLIDE_BUILDER_ASSISTANT));
|
||||
Assert.That(destinations, Does.Contain(AIStudio.Tools.Components.CHAT));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheChatOffersANewChat()
|
||||
{
|
||||
var destinations = AssistantLaunchService.SelectDestinations(AIStudio.Tools.Components.CHAT, _ => true);
|
||||
Assert.That(destinations, Does.Contain(AIStudio.Tools.Components.CHAT), "A new chat is another chat than the one which sends.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnlyComponentsWhichTakeContentAreOffered()
|
||||
{
|
||||
var destinations = AssistantLaunchService.SelectDestinations(AIStudio.Tools.Components.CHAT, _ => true);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(destinations, Is.Not.Empty);
|
||||
Assert.That(destinations.All(destination => destination.AllowSendTo()), Is.True);
|
||||
Assert.That(destinations, Does.Not.Contain(AIStudio.Tools.Components.DYNAMIC_ASSISTANT), "Assistant plugins cannot take content yet.");
|
||||
Assert.That(destinations, Does.Not.Contain(AIStudio.Tools.Components.NONE));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnAssistantTheUserDoesNotSeeIsNotOffered()
|
||||
{
|
||||
var destinations = AssistantLaunchService.SelectDestinations(AIStudio.Tools.Components.CHAT, destination => destination is not AIStudio.Tools.Components.SLIDE_BUILDER_ASSISTANT);
|
||||
Assert.That(destinations, Does.Not.Contain(AIStudio.Tools.Components.SLIDE_BUILDER_ASSISTANT));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShorterNamesComeFirst()
|
||||
{
|
||||
var lengths = AssistantLaunchService.SelectDestinations(AIStudio.Tools.Components.CHAT, _ => true).Select(destination => destination.Name().Length).ToList();
|
||||
Assert.That(lengths, Is.Ordered);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user