mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 05:47:21 +00:00
Moved all extension methods into extension blocks (#1155)
This commit is contained in:
1 parent
acc7d09fa2
commit
c0a75f39ac
138 files changed
+5884
-4954
No files matched your search
@@ -2,20 +2,23 @@ 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();
|
||||
extension(IEnumerable<IDataSource> dataSources)
|
||||
{
|
||||
/// <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>
|
||||
/// <returns>The data sources in their fixed order.</returns>
|
||||
public IReadOnlyList<IDataSource> InFixedOrder() => dataSources
|
||||
.OrderBy(dataSource => dataSource.Num)
|
||||
.ThenBy(dataSource => dataSource.Id, StringComparer.Ordinal)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user