mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 10:07: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,29 +2,32 @@ namespace AIStudio.Tools.ToolCallingSystem;
|
||||
|
||||
public static class SafeSearchPolicyExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// The value SearXNG expects for its safesearch parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// SearXNG takes the level as a number. That number stays here, at the edge towards the
|
||||
/// search engine, instead of travelling through the settings where nobody can read it.
|
||||
/// </remarks>
|
||||
public static string ToSearXNGValue(this SafeSearchPolicy policy) => policy switch
|
||||
extension(SafeSearchPolicy policy)
|
||||
{
|
||||
SafeSearchPolicy.OFF => "0",
|
||||
SafeSearchPolicy.MODERATE => "1",
|
||||
SafeSearchPolicy.STRICT => "2",
|
||||
/// <summary>
|
||||
/// The value SearXNG expects for its safesearch parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// SearXNG takes the level as a number. That number stays here, at the edge towards the
|
||||
/// search engine, instead of travelling through the settings where nobody can read it.
|
||||
/// </remarks>
|
||||
public string ToSearXNGValue() => policy switch
|
||||
{
|
||||
SafeSearchPolicy.OFF => "0",
|
||||
SafeSearchPolicy.MODERATE => "1",
|
||||
SafeSearchPolicy.STRICT => "2",
|
||||
|
||||
_ => "0",
|
||||
};
|
||||
_ => "0",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The value Tavily expects for its safe search parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Tavily knows filtering only as on or off, so a moderate policy is filtered as strictly as
|
||||
/// a strict one. Of the two ways to round that, filtering more than was asked for is the one
|
||||
/// that cannot surprise anyone.
|
||||
/// </remarks>
|
||||
public static bool ToTavilyValue(this SafeSearchPolicy policy) => policy is not SafeSearchPolicy.OFF;
|
||||
/// <summary>
|
||||
/// The value Tavily expects for its safe search parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Tavily knows filtering only as on or off, so a moderate policy is filtered as strictly as
|
||||
/// a strict one. Of the two ways to round that, filtering more than was asked for is the one
|
||||
/// that cannot surprise anyone.
|
||||
/// </remarks>
|
||||
public bool ToTavilyValue() => policy is not SafeSearchPolicy.OFF;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user