Misc updates

This commit is contained in:
a8trejo 2024-11-27 23:12:58 -08:00
parent 8d73ad713b
commit 7028670ada
2 changed files with 13 additions and 16 deletions

View file

@ -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
}
}

View file

@ -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
}
}