From 7028670ada26abd413ab5008bfd93cae66c86d28 Mon Sep 17 00:00:00 2001 From: a8trejo Date: Wed, 27 Nov 2024 23:12:58 -0800 Subject: [PATCH] Misc updates --- src/core/Cline.ts | 13 ++++--------- src/services/browser/BrowserSession.ts | 16 +++++++++------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index 321fe34545..146a9b9c3d 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -1504,7 +1504,7 @@ export class Cline { } this.consecutiveMistakeCount = 0 - const didApprove = await askApproval("browser_action_launch", url) + const didApprove = this.alwaysAllowBrowser || await askApproval("browser_action_launch", url) if (!didApprove) { break } @@ -1567,7 +1567,6 @@ export class Cline { break } } - switch (action) { case "launch": case "click": @@ -1595,7 +1594,7 @@ export class Cline { break } } catch (error) { - await this.browserSession.closeBrowser() + await this.browserSession.closeBrowser() // if any error occurs, the browser session is terminated await handleError("executing browser action", error) break } @@ -1763,11 +1762,7 @@ export class Cline { const { response, text, images } = await this.ask("completion_result", "", false) if (response === "yesButtonClicked") { - // Only close browser if not in interactive mode - if (!this.browserSession.isInInteractiveMode) { - await this.browserSession.closeBrowser() - } - pushToolResult("") + pushToolResult("") // signals to recursive loop to stop (for now this never happens since yesButtonClicked will trigger a new task) break } await this.say("user_feedback", text ?? "", images) @@ -1794,7 +1789,7 @@ export class Cline { break } } catch (error) { - await handleError("completing task", error) + await handleError("inspecting site", error) break } } diff --git a/src/services/browser/BrowserSession.ts b/src/services/browser/BrowserSession.ts index 61d328eed1..91bd4b286e 100644 --- a/src/services/browser/BrowserSession.ts +++ b/src/services/browser/BrowserSession.ts @@ -56,8 +56,8 @@ export class BrowserSession { "--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36", ], defaultViewport: { - width: 900, - height: 600 + width: 1440, + height: 900 }, headless: false, // Always use non-headless mode }) @@ -65,6 +65,12 @@ export class BrowserSession { } this.page = await this.browser?.newPage() + await this.page?.setViewport({ + width: 1440, + height: 900, + deviceScaleFactor: 1, + isMobile: false + }); return { screenshot: "", @@ -182,7 +188,7 @@ export class BrowserSession { } private async waitTillHTMLStable(page: Page, timeout = 5_000) { - const checkDurationMsecs = 500 + const checkDurationMsecs = 500 // 1000 const maxChecks = timeout / checkDurationMsecs let lastHTMLSize = 0 let checkCounts = 1 @@ -273,8 +279,4 @@ export class BrowserSession { await delay(300) }) } - - get isInInteractiveMode(): boolean { - return this.isInteractive - } }