mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-09-29 18:23:36 +00:00
Some checks are pending
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
52 lines
2.4 KiB
C#
52 lines
2.4 KiB
C#
using AIStudio.Chat;
|
|
using AIStudio.Settings.DataModel;
|
|
|
|
namespace AIStudio.Tests.Chat;
|
|
|
|
/// <summary>
|
|
/// Checks how the data a chat has seen tightens the providers which may continue it.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// A chat which once held data for self-hosted providers only must never be sent to any other
|
|
/// provider again, whatever it brings in afterwards. The RAG process and Semantic Search both go
|
|
/// through the same rule, so every combination of what a chat holds and what arrives is checked.
|
|
/// </remarks>
|
|
[TestFixture]
|
|
public sealed class ChatThreadDataSecurityTests
|
|
{
|
|
[TestCase(DataSourceSecurity.NOT_SPECIFIED, DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.SELF_HOSTED)]
|
|
[TestCase(DataSourceSecurity.ALLOW_ANY, DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.SELF_HOSTED)]
|
|
[TestCase(DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.SELF_HOSTED)]
|
|
public void DataForSelfHostedProvidersOnlyRestrictsTheChat(DataSourceSecurity held, DataSourceSecurity arriving, DataSourceSecurity expected)
|
|
{
|
|
Assert.That(Tightened(held, arriving), Is.EqualTo(expected));
|
|
}
|
|
|
|
[TestCase(DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.ALLOW_ANY)]
|
|
[TestCase(DataSourceSecurity.SELF_HOSTED, DataSourceSecurity.NOT_SPECIFIED)]
|
|
public void ARestrictionStays(DataSourceSecurity held, DataSourceSecurity arriving)
|
|
{
|
|
Assert.That(Tightened(held, arriving), Is.EqualTo(DataSourceSecurity.SELF_HOSTED), "The restricted data was seen by this chat. What arrives later cannot undo that.");
|
|
}
|
|
|
|
[TestCase(DataSourceSecurity.NOT_SPECIFIED)]
|
|
[TestCase(DataSourceSecurity.ALLOW_ANY)]
|
|
public void DataForAnyProviderMarksTheChat(DataSourceSecurity held)
|
|
{
|
|
Assert.That(Tightened(held, DataSourceSecurity.ALLOW_ANY), Is.EqualTo(DataSourceSecurity.ALLOW_ANY));
|
|
}
|
|
|
|
[TestCase(DataSourceSecurity.NOT_SPECIFIED)]
|
|
[TestCase(DataSourceSecurity.ALLOW_ANY)]
|
|
public void ResultsWhichDemandNothingChangeNothing(DataSourceSecurity held)
|
|
{
|
|
Assert.That(Tightened(held, DataSourceSecurity.NOT_SPECIFIED), Is.EqualTo(held), "A web search, say, says nothing about data sources and must leave the chat as it was.");
|
|
}
|
|
|
|
private static DataSourceSecurity Tightened(DataSourceSecurity held, DataSourceSecurity arriving)
|
|
{
|
|
var thread = new ChatThread { DataSecurity = held };
|
|
thread.RequireDataSecurity(arriving);
|
|
return thread.DataSecurity;
|
|
}
|
|
} |