From 465497592b7892a7a077892157825add37ffa6b2 Mon Sep 17 00:00:00 2001 From: Peer Hogeterp <20603780+peerschuett@users.noreply.github.com> Date: Wed, 23 Sep 2026 13:18:48 +0200 Subject: [PATCH] Show only On and Off for Brave Mode --- app/MindWork AI Studio/Assistants/I18N/allTexts.lua | 9 +++++++++ .../Dialogs/Settings/ToolSettingsDialog.razor | 2 +- .../Dialogs/Settings/ToolSettingsDialog.razor.cs | 5 +++++ .../ToolCallingImplementations/ReadWebPageTool.cs | 2 +- .../ToolCallingSystem/ToolSettingsFieldDefinition.cs | 8 +++++++- .../Tools/ToolCallingSystem/ToolSettingsSchemaBuilder.cs | 8 ++++++-- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 88c36251..8488d64d 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -12571,6 +12571,9 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGAVAILABILITYEXTE -- Allowed private hosts must be host names only, without scheme or path. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T2196457612"] = "Allowed private hosts must be host names only, without scheme or path." +-- Off: the model is instructed to read only URLs supplied in the system prompt, your message (including loaded documents and retrieved data), or tool results. On: the model may choose a URL itself. This instruction guides the model; it does not technically block URL requests. +UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T2219424031"] = "Off: the model is instructed to read only URLs supplied in the system prompt, your message (including loaded documents and retrieved data), or tool results. On: the model may choose a URL itself. This instruction guides the model; it does not technically block URL requests." + -- The web page was not loaded because private or VPN web pages require a High-confidence provider or a provider trusted by your organization's configuration. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T2563437007"] = "The web page was not loaded because private or VPN web pages require a High-confidence provider or a provider trusted by your organization's configuration." @@ -12595,12 +12598,18 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS: -- (Optional) Host allowlist for private or VPN web pages. For security reasons, private or VPN web pages aren't allowed to be read by default. Separate host patterns with commas, such as example.de, *.example.de. Allowed private hosts require a High-confidence provider or a provider trusted by your organization's configuration. For allowed HTTPS internal hosts, AI Studio also tries the operating system's default sign-in automatically when the server responds with integrated authentication. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T3802894016"] = "(Optional) Host allowlist for private or VPN web pages. For security reasons, private or VPN web pages aren't allowed to be read by default. Separate host patterns with commas, such as example.de, *.example.de. Allowed private hosts require a High-confidence provider or a provider trusted by your organization's configuration. For allowed HTTPS internal hosts, AI Studio also tries the operating system's default sign-in automatically when the server responds with integrated authentication." +-- Brave Mode must be Off or On. +UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T4125722529"] = "Brave Mode must be Off or On." + -- (Optional) HTTP timeout for loading a web page in seconds. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T4126164830"] = "(Optional) HTTP timeout for loading a web page in seconds." -- The setting '{0}' must be a positive integer. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T4199432074"] = "The setting '{0}' must be a positive integer." +-- Brave Mode +UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T767509756"] = "Brave Mode" + -- (Optional) Global truncation limit for extracted characters returned to the model. UI_TEXT_CONTENT["AISTUDIO::TOOLS::TOOLCALLINGSYSTEM::TOOLCALLINGIMPLEMENTATIONS::READWEBPAGETOOL::T900659180"] = "(Optional) Global truncation limit for extracted characters returned to the model." diff --git a/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor b/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor index d7124026..0eff5a1b 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor +++ b/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor @@ -58,7 +58,7 @@ if (fieldOptions.Count > 0) { - @if (!this.toolDefinition.SettingsSchema.Required.Contains(fieldName)) + @if (!this.toolDefinition.SettingsSchema.Required.Contains(fieldName) && string.IsNullOrEmpty(field.DefaultValue)) { @T("Not set") } diff --git a/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor.cs index e57ed092..311674cb 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/ToolSettingsDialog.razor.cs @@ -29,6 +29,11 @@ public partial class ToolSettingsDialog : SettingsDialogBase { this.implementation = this.ToolRegistry.GetImplementation(this.toolDefinition.ImplementationKey); this.values = await this.ToolSettingsService.GetSettingsAsync(this.toolDefinition); + foreach (var (fieldName, field) in this.toolDefinition.SettingsSchema.Properties) + { + if (!string.IsNullOrEmpty(field.DefaultValue) && string.IsNullOrEmpty(this.GetValue(fieldName))) + this.values[fieldName] = field.DefaultValue; + } this.fieldGroups = BuildFieldGroups(this.toolDefinition); } } diff --git a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolCallingImplementations/ReadWebPageTool.cs b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolCallingImplementations/ReadWebPageTool.cs index 7a74651f..bc8aa1e2 100644 --- a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolCallingImplementations/ReadWebPageTool.cs +++ b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolCallingImplementations/ReadWebPageTool.cs @@ -41,7 +41,7 @@ public sealed class ReadWebPageTool(WebPageRetrievalService webPageRetrievalServ .Optional(TIMEOUT_SECONDS_SETTING) .Optional(MAX_CONTENT_CHARACTERS_SETTING) .Optional(ALLOWED_PRIVATE_HOSTS_SETTING) - .OptionalEnum(BRAVE_MODE_SETTING, BRAVE_MODE_OFF, BRAVE_MODE_ON) + .OptionalEnumWithDefault(BRAVE_MODE_SETTING, BRAVE_MODE_OFF, BRAVE_MODE_OFF, BRAVE_MODE_ON) .Build(), SystemPromptInstructions = BuildSystemPromptInstructions(BRAVE_MODE_OFF), diff --git a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsFieldDefinition.cs b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsFieldDefinition.cs index 30db093e..d294612f 100644 --- a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsFieldDefinition.cs +++ b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsFieldDefinition.cs @@ -13,6 +13,12 @@ public sealed class ToolSettingsFieldDefinition [JsonPropertyName("enum")] public List EnumValues { get; init; } = []; + /// + /// Value shown and saved for an optional choice when no value has been stored yet. + /// A choice with a default does not offer a separate "Not set" option. + /// + public string DefaultValue { get; init; } = string.Empty; + /// /// Name of a list of options the app maintains, as an alternative to spelling them out in /// the enum field. See the tool settings option sources for the available names. @@ -44,4 +50,4 @@ public sealed class ToolSettingsFieldDefinition public IReadOnlyList GetOptions() => string.IsNullOrWhiteSpace(this.OptionSource) ? this.EnumValues.Select(value => new ToolSettingsOption(value, value)).ToList() : ToolSettingsOptionSources.Resolve(this.OptionSource); -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsSchemaBuilder.cs b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsSchemaBuilder.cs index a42af612..a7f025ce 100644 --- a/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsSchemaBuilder.cs +++ b/app/MindWork AI Studio/Tools/ToolCallingSystem/ToolSettingsSchemaBuilder.cs @@ -61,6 +61,9 @@ public sealed class ToolSettingsSchemaBuilder /// public ToolSettingsSchemaBuilder OptionalEnum(string name, params string[] values) => this.Add(name, isRequired: false, enumValues: values); + public ToolSettingsSchemaBuilder OptionalEnumWithDefault(string name, string defaultValue, params string[] values) => + this.Add(name, isRequired: false, enumValues: values, defaultValue: defaultValue); + /// /// A field kept in the operating system's keyring rather than in the settings file. /// @@ -74,12 +77,13 @@ public sealed class ToolSettingsSchemaBuilder Required = [..this.requiredNames], }; - private ToolSettingsSchemaBuilder Add(string name, bool isRequired, string optionSource = "", bool isSecret = false, IReadOnlyList? enumValues = null) + private ToolSettingsSchemaBuilder Add(string name, bool isRequired, string optionSource = "", bool isSecret = false, IReadOnlyList? enumValues = null, string defaultValue = "") { this.properties[name] = new ToolSettingsFieldDefinition { OptionSource = optionSource, EnumValues = enumValues?.ToList() ?? [], + DefaultValue = defaultValue, Secret = isSecret, Group = this.currentGroup, }; @@ -89,4 +93,4 @@ public sealed class ToolSettingsSchemaBuilder return this; } -} \ No newline at end of file +}