mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 10:39:07 +00:00
Added mailboxes as local data sources (#1022)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
93be539e50
commit
c4400c0ff6
343 files changed
+26051
-3122
No files matched your search
@@ -0,0 +1,80 @@
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.Services;
|
||||
using AIStudio.Tools.Validation;
|
||||
|
||||
namespace AIStudio.Tests.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which provider confidence levels a mailbox may require, and which providers may read it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For the other data sources, NONE means that any provider may read them, and UNTRUSTED or UNKNOWN
|
||||
/// let even a provider through which nobody rated. A mailbox gets none of that: it requires a level
|
||||
/// from very low to high, and without one, no provider may read it, however the level got there.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class MailboxConfidenceTests
|
||||
{
|
||||
private static readonly ConfidenceLevel[] MAILBOX_LEVELS = [ConfidenceLevel.VERY_LOW, ConfidenceLevel.LOW, ConfidenceLevel.MODERATE, ConfidenceLevel.MEDIUM, ConfidenceLevel.HIGH];
|
||||
|
||||
private static readonly ConfidenceLevel[] FORBIDDEN_LEVELS = [ConfidenceLevel.NONE, ConfidenceLevel.UNTRUSTED, ConfidenceLevel.UNKNOWN];
|
||||
|
||||
[Test]
|
||||
public void TheChoiceOffersTheLevelsFromVeryLowToHigh()
|
||||
{
|
||||
var offeredLevels = ConfigurationSelectDataFactory.GetMailboxConfidenceLevelsData().Select(option => option.Value);
|
||||
Assert.That(offeredLevels, Is.EqualTo(MAILBOX_LEVELS));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EveryLevelIsEitherAllowedOrForbidden()
|
||||
{
|
||||
//
|
||||
// A level added to ConfidenceLevel later has to be placed on purpose, rather than slip into
|
||||
// the mailboxes, or out of them, by its value.
|
||||
//
|
||||
Assert.That(Enum.GetValues<ConfidenceLevel>(), Is.EquivalentTo(MAILBOX_LEVELS.Concat(FORBIDDEN_LEVELS)));
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(FORBIDDEN_LEVELS))]
|
||||
public void AMailboxWithAForbiddenLevelIsClosedToEveryProvider(ConfidenceLevel mailboxLevel)
|
||||
{
|
||||
var admittedLevels = Enum.GetValues<ConfidenceLevel>().Where(providerLevel => providerLevel.AllowsMailboxConfidenceLevel(mailboxLevel));
|
||||
Assert.That(admittedLevels, Is.Empty);
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(MAILBOX_LEVELS))]
|
||||
public void AProviderHasToMeetTheLevelOfTheMailbox(ConfidenceLevel mailboxLevel)
|
||||
{
|
||||
var admittedLevels = Enum.GetValues<ConfidenceLevel>().Where(providerLevel => providerLevel.AllowsMailboxConfidenceLevel(mailboxLevel));
|
||||
Assert.That(admittedLevels, Is.EqualTo(MAILBOX_LEVELS.Where(level => level >= mailboxLevel)));
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(FORBIDDEN_LEVELS))]
|
||||
public void NoEmbeddingProviderIndexesAMailboxWithAForbiddenLevel(ConfidenceLevel mailboxLevel)
|
||||
{
|
||||
var mailbox = new DataSourceMailbox { ConfidenceLevel = mailboxLevel };
|
||||
Assert.That(DataSourceEmbeddingService.AllowsEmbedding(mailbox, ConfidenceLevel.HIGH), Is.False, "The indexing run asked the rule of the other data sources, which lets every provider read a source without a level.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFolderWithoutALevelStaysOpenToEveryEmbeddingProvider()
|
||||
{
|
||||
var directory = new DataSourceLocalDirectory { ConfidenceLevel = ConfidenceLevel.NONE };
|
||||
Assert.That(DataSourceEmbeddingService.AllowsEmbedding(directory, ConfidenceLevel.UNTRUSTED), Is.True, "The stricter rule of the mailboxes reached the other data sources.");
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(FORBIDDEN_LEVELS))]
|
||||
public void TheDialogRejectsAForbiddenLevel(ConfidenceLevel level)
|
||||
{
|
||||
Assert.That(new DataSourceValidation().ValidateMailboxConfidenceLevel(level), Is.Not.Null);
|
||||
}
|
||||
|
||||
[TestCaseSource(nameof(MAILBOX_LEVELS))]
|
||||
public void TheDialogAcceptsAnAllowedLevel(ConfidenceLevel level)
|
||||
{
|
||||
Assert.That(new DataSourceValidation().ValidateMailboxConfidenceLevel(level), Is.Null);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user