mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-14 01:27:21 +00:00
Added the choice between formal and informal address to the whole app (#1200)
This commit is contained in:
1 parent
382db4b8d0
commit
c9a376f742
342 files changed
+14378
-1893
No files matched your search
@@ -61,13 +61,5 @@ public sealed class BflAccessTests
|
||||
Assert.That(levels, Is.EqualTo(new[] { ConfidenceLevel.HIGH }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheSettingsOfferEveryFormOfAddress()
|
||||
{
|
||||
var forms = ConfigurationSelectDataFactory.GetBeyondFactsLabAddressFormData().Select(data => data.Value);
|
||||
|
||||
Assert.That(forms, Is.EquivalentTo(Enum.GetValues<AddressForm>()));
|
||||
}
|
||||
|
||||
private static SettingsManager CreateSettingsManager() => new(NullLogger<SettingsManager>.Instance, null!);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using SharedTools;
|
||||
|
||||
namespace AIStudio.Tests.BeyondFactsLab;
|
||||
|
||||
/// <summary>
|
||||
/// Checks that the texts of the BeyondFacts Lab follow the form of address the person chose.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A text which says "you" in English addresses the reader in other languages as well, so it needs TA(). With T() or
|
||||
/// TB(), it would stay formal in German, although the person chose the informal address.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed partial class BflAddressTests
|
||||
{
|
||||
[Test]
|
||||
public void EveryTextOfTheLabWhichSaysYouFollowsTheFormOfAddress()
|
||||
{
|
||||
var texts = 0;
|
||||
var formalOnly = new List<string>();
|
||||
foreach (var file in LabSourceFiles())
|
||||
{
|
||||
foreach (var text in I18NSourceScanner.FindTexts(File.ReadAllText(file), file, []))
|
||||
{
|
||||
texts++;
|
||||
if (!text.HasAddressVariants && YouRegex().IsMatch(text.Text))
|
||||
formalOnly.Add($"{Path.GetFileName(file)}: {text.Text}");
|
||||
}
|
||||
}
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(texts, Is.GreaterThan(80), "The test found too few texts to be looking at the lab.");
|
||||
Assert.That(formalOnly, Is.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"\byou(r|rs|rself)?\b", RegexOptions.IgnoreCase)]
|
||||
private static partial Regex YouRegex();
|
||||
|
||||
private static IEnumerable<string> LabSourceFiles([CallerFilePath] string sourceFilePath = "")
|
||||
{
|
||||
var appDirectory = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(sourceFilePath)!, "..", "..", "MindWork AI Studio"));
|
||||
return Directory.EnumerateFiles(Path.Combine(appDirectory, "Assistants", "BeyondFactsLab"))
|
||||
.Append(Path.Combine(appDirectory, "Dialogs", "Settings", "SettingsDialogBeyondFactsLab.razor"));
|
||||
}
|
||||
}
|
||||
@@ -138,12 +138,6 @@ public sealed class BflComponentTests
|
||||
Assert.That(LAB.PreselectedProvider(settingsManager).Id, Is.EqualTo(provider.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NewSettingsAddressFormally()
|
||||
{
|
||||
Assert.That(new DataBeyondFactsLab().AddressForm, Is.EqualTo(AddressForm.FORMAL), "The texts of AI Studio address the person formally as well.");
|
||||
}
|
||||
|
||||
private static SettingsManager CreateSettingsManager() => new(NullLogger<SettingsManager>.Instance, null!);
|
||||
|
||||
private static AIStudio.Settings.Provider CreateProvider(LLMProviders llmProvider) => new(1, Guid.NewGuid().ToString(), "Test", llmProvider, new("test-model", null));
|
||||
|
||||
Reference in new issue
Block a user