Skip to content

Commit 11e67d9

Browse files
committed
fix settings provider
1 parent ef6a1e6 commit 11e67d9

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

patches/nxtscape/New-BrowserOS-settings-AI-page-for-providers.patch

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
From 21e829f4a3766c75c0d2f325f9aa188f6c327fcb Mon Sep 17 00:00:00 2001
1+
From 3e8f702bd2dca95dee182cd147a2cda413e0c9a6 Mon Sep 17 00:00:00 2001
22
From: Nikhil Sonti <nikhilsv92@gmail.com>
33
Date: Tue, 5 Aug 2025 17:34:40 -0700
4-
Subject: [PATCH 3/3] New BrowserOS settings AI page for providers
4+
Subject: [PATCH] New BrowserOS settings AI page for providers
55

66
---
77
.../api/settings_private/prefs_util.cc | 1 +
88
chrome/browser/prefs/browser_prefs.cc | 12 +-
9-
.../settings/nxtscape_page/nxtscape_page.html | 842 +++++++++---------
10-
.../settings/nxtscape_page/nxtscape_page.ts | 618 +++++++++----
9+
.../settings/nxtscape_page/nxtscape_page.html | 840 +++++++++---------
10+
.../settings/nxtscape_page/nxtscape_page.ts | 620 +++++++++----
1111
chrome/common/pref_names.h | 7 +
1212
5 files changed, 905 insertions(+), 575 deletions(-)
1313

@@ -47,7 +47,7 @@ index cf120aacb58d3..7cc63f0c20cc4 100644
4747
registry->RegisterStringPref("nxtscape.nxtscape_model", "");
4848

4949
diff --git a/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.html b/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.html
50-
index 28e18b5f69f95..5370f2e079c7e 100644
50+
index 28e18b5f69f95..9a429f31f43a0 100644
5151
--- a/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.html
5252
+++ b/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.html
5353
@@ -1,13 +1,23 @@
@@ -479,7 +479,7 @@ index 28e18b5f69f95..5370f2e079c7e 100644
479479
}
480480

481481
.status-toast.show {
482-
@@ -236,406 +426,236 @@
482+
@@ -236,406 +426,234 @@
483483
opacity: 1;
484484
}
485485

@@ -817,31 +817,29 @@ index 28e18b5f69f95..5370f2e079c7e 100644
817817
+
818818
<div class="form-group">
819819
- <label class="form-label" for="anthropicApiKey">API Key</label>
820-
+ <label class="form-label">
821-
+ API Key <span class="required" hidden$="[[dialogProviderType_ === 'ollama']]">*</span>
822-
+ </label>
820+
+ <label class="form-label">API Key</label>
823821
<input type="password"
824822
- id="anthropicApiKey"
825-
- class="form-field"
823+
class="form-field"
826824
- value="[[prefs.nxtscape.anthropic_api_key.value]]"
827825
- on-input="onAnthropicApiKeyChange_"
828826
- placeholder="Enter your Anthropic API key"
829827
- required>
830828
- <div class="form-helper">Your Anthropic API key (required)</div>
831-
- </div>
829+
+ value="{{dialogApiKey_::input}}"
830+
+ placeholder="Enter your API key (optional for some providers)">
831+
+ <div class="form-helper">Your API key is encrypted and stored locally</div>
832+
</div>
832833
- <div class="form-group">
833834
- <label class="form-label" for="anthropicBaseUrl">Base URL (Optional)</label>
834835
- <input type="url"
835836
- id="anthropicBaseUrl"
836-
class="form-field"
837+
- class="form-field"
837838
- value="[[prefs.nxtscape.anthropic_base_url.value]]"
838839
- on-input="onAnthropicBaseUrlChange_"
839840
- placeholder="https://api.anthropic.com">
840841
- <div class="form-helper">Override the Anthropic API base URL (leave empty for default)</div>
841-
+ value="{{dialogApiKey_::input}}"
842-
+ placeholder="Enter your API key">
843-
+ <div class="form-helper">Your API key is encrypted and stored locally</div>
844-
</div>
842+
- </div>
845843
- <div class="form-group">
846844
- <label class="form-label" for="anthropicModel">Model</label>
847845
- <select id="anthropicModel" class="form-field"
@@ -1076,9 +1074,8 @@ index 28e18b5f69f95..5370f2e079c7e 100644
10761074
\ No newline at end of file
10771075
+ <span>Settings saved successfully</span>
10781076
+ </div>
1079-
\ No newline at end of file
10801077
diff --git a/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.ts b/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.ts
1081-
index 8c4421ef76e45..9de49d6e658a0 100644
1078+
index 8c4421ef76e45..e9bebf5e2236f 100644
10821079
--- a/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.ts
10831080
+++ b/chrome/browser/resources/settings/nxtscape_page/nxtscape_page.ts
10841081
@@ -14,6 +14,8 @@ import 'chrome://resources/cr_elements/cr_button/cr_button.js';
@@ -1175,7 +1172,7 @@ index 8c4421ef76e45..9de49d6e658a0 100644
11751172
export class SettingsNxtscapePageElement extends SettingsNxtscapePageElementBase {
11761173
static get is() {
11771174
return 'settings-nxtscape-page';
1178-
@@ -33,222 +113,438 @@ export class SettingsNxtscapePageElement extends SettingsNxtscapePageElementBase
1175+
@@ -33,222 +113,440 @@ export class SettingsNxtscapePageElement extends SettingsNxtscapePageElementBase
11791176

11801177
static get properties() {
11811178
return {
@@ -1593,11 +1590,13 @@ index 8c4421ef76e45..9de49d6e658a0 100644
15931590
+ return false;
15941591
+ }
15951592
+
1596-
+ // API key is optional for Ollama, OpenAI Compatible, and Custom providers
1593+
+ // API key is optional for all providers, but show warning if missing for certain types
15971594
+ const apiKeyOptionalTypes = [ProviderType.OLLAMA, ProviderType.OPENAI_COMPATIBLE, ProviderType.CUSTOM];
1598-
+ if (!this.dialogApiKey_ || (!this.dialogApiKey_.trim() && !apiKeyOptionalTypes.includes(this.dialogProviderType_))) {
1599-
+ this.showStatusMessage_('API key is required', true);
1600-
+ return false;
1595+
+ if (!this.dialogApiKey_ || !this.dialogApiKey_.trim()) {
1596+
+ if (!apiKeyOptionalTypes.includes(this.dialogProviderType_)) {
1597+
+ // Show warning but don't block
1598+
+ this.showStatusMessage_('Warning: API key not provided. Provider may not work without it.', false);
1599+
+ }
16011600
+ }
16021601
+
16031602
+ if (!this.dialogModelId_ || !this.dialogModelId_.trim()) {
@@ -1774,7 +1773,7 @@ index 8c4421ef76e45..9de49d6e658a0 100644
17741773
statusMessage.classList.add('show');
17751774
setTimeout(() => {
17761775
statusMessage.classList.remove('show');
1777-
@@ -264,4 +560,4 @@ declare global {
1776+
@@ -264,4 +562,4 @@ declare global {
17781777
}
17791778

17801779
customElements.define(

0 commit comments

Comments
 (0)