mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 00:47:21 +00:00
Outbound data restrictions after searching data sources (#1106)
This commit is contained in:
1 parent
7ba5f01388
commit
8c5cfa78b6
61 files changed
+1389
-143
No files matched your search
@@ -0,0 +1,21 @@
|
||||
namespace AIStudio.Settings;
|
||||
|
||||
public static class DataSourceOrderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sorts data sources in a fixed order: by their number, then by their ID.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The same data sources always come in the same order, however the settings list them, the
|
||||
/// checks return them, or an agent selects them. Semantic Search offers them this way, because
|
||||
/// the providers cache a request from its beginning, and the tools are part of that beginning,
|
||||
/// see IToolImplementation.ResolveFunctionAsync. DataSourceRequirements names the first of
|
||||
/// several equally strict data sources this way, so that both ways of searching name the same.
|
||||
/// </remarks>
|
||||
/// <param name="dataSources">The data sources to sort.</param>
|
||||
/// <returns>The data sources in their fixed order.</returns>
|
||||
public static IReadOnlyList<IDataSource> InFixedOrder(this IEnumerable<IDataSource> dataSources) => dataSources
|
||||
.OrderBy(dataSource => dataSource.Num)
|
||||
.ThenBy(dataSource => dataSource.Id, StringComparer.Ordinal)
|
||||
.ToList();
|
||||
}
|
||||
Reference in new issue
Block a user