Skip to content

Commit 353cc8a

Browse files
committed
Only show browser assistant mode if remote browser enabled
1 parent 56d591b commit 353cc8a

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/services/browser/BrowserSession.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ export class BrowserSession {
354354
const normalizedNewUrl = url.replace(/\/$/, "")
355355

356356
// Check if browser assistant mode is enabled
357+
const remoteBrowserEnabled = this.context.globalState.get("remoteBrowserEnabled") as string | undefined
357358
const browserAssistantModeEnabled = this.context.globalState.get("browserAssistantModeEnabled") as
358359
| boolean
359360
| undefined
@@ -364,7 +365,7 @@ export class BrowserSession {
364365
// Try to find a page with the same root domain or use the latest tab in assistant mode
365366
let existingPage: Page | undefined
366367

367-
if (browserAssistantModeEnabled) {
368+
if (browserAssistantModeEnabled && remoteBrowserEnabled) {
368369
// In assistant mode, always use the latest tab (last in the array)
369370
// Skip the first page which is usually the blank page
370371
existingPage = pages.length >= 1 ? pages[pages.length - 1] : undefined
@@ -401,7 +402,7 @@ export class BrowserSession {
401402
const currentUrl = existingPage.url().replace(/\/$/, "") // Remove trailing / if present
402403

403404
if (
404-
browserAssistantModeEnabled ||
405+
(browserAssistantModeEnabled && remoteBrowserEnabled) ||
405406
(this.getRootDomain(currentUrl) === this.getRootDomain(normalizedNewUrl) &&
406407
currentUrl !== normalizedNewUrl)
407408
) {

webview-ui/src/components/settings/BrowserSettings.tsx

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -212,28 +212,27 @@ export const BrowserSettings = ({
212212
<div className="text-vscode-descriptionForeground text-sm mt-1">
213213
{t("settings:browser.remote.instructions")}
214214
</div>
215+
<div>
216+
<VSCodeCheckbox
217+
checked={browserAssistantModeEnabled}
218+
onChange={(e: any) => {
219+
setCachedStateField("browserAssistantModeEnabled", e.target.checked)
220+
}}>
221+
<label className="block font-medium mb-1">
222+
{t("settings:browser.assistantMode.label")}
223+
</label>
224+
</VSCodeCheckbox>
225+
<div className="text-vscode-descriptionForeground text-sm mt-1">
226+
{t("settings:browser.assistantMode.description")}
227+
</div>
228+
{browserAssistantModeEnabled && (
229+
<div className="text-vscode-descriptionForeground text-sm mt-1">
230+
{t("settings:browser.assistantMode.instructions")}
231+
</div>
232+
)}
233+
</div>
215234
</>
216235
)}
217-
218-
<div>
219-
<VSCodeCheckbox
220-
checked={browserAssistantModeEnabled}
221-
onChange={(e: any) => {
222-
setCachedStateField("browserAssistantModeEnabled", e.target.checked)
223-
}}>
224-
<label className="block font-medium mb-1">
225-
{t("settings:browser.assistantMode.label")}
226-
</label>
227-
</VSCodeCheckbox>
228-
<div className="text-vscode-descriptionForeground text-sm mt-1">
229-
{t("settings:browser.assistantMode.description")}
230-
</div>
231-
{browserAssistantModeEnabled && (
232-
<div className="text-vscode-descriptionForeground text-sm mt-1">
233-
{t("settings:browser.assistantMode.instructions")}
234-
</div>
235-
)}
236-
</div>
237236
</div>
238237
)}
239238
</Section>

0 commit comments

Comments
 (0)