fix: timeouts for browser

pull/147/head
Travis Fischer 2022-12-15 19:00:09 -06:00
rodzic 504d8d513b
commit 025f9682e4
2 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -262,7 +262,10 @@ export class ChatGPTAPIBrowser {
const markdownMessages = htmlMessages.map((messageHtml) => {
// parse markdown from message HTML
messageHtml = messageHtml.replace('Copy code</button>', '</button>')
messageHtml = messageHtml
.replaceAll('Copy code</button>', '</button>')
.replace(/Copy code\s*<\/button>/gim, '</button>')
return html2md(messageHtml, {
ignoreTags: [
'button',

Wyświetl plik

@ -71,7 +71,7 @@ export async function getOpenAIAuth({
}
await page.goto('https://chat.openai.com/auth/login', {
waitUntil: 'networkidle0'
waitUntil: 'networkidle2'
})
// NOTE: this is where you may encounter a CAPTCHA
@ -93,7 +93,8 @@ export async function getOpenAIAuth({
// click login button and wait for navigation to finish
await Promise.all([
page.waitForNavigation({
waitUntil: 'networkidle0'
waitUntil: 'networkidle2',
timeout: timeoutMs
}),
page.click('#__next .btn-primary')
@ -134,7 +135,8 @@ export async function getOpenAIAuth({
await Promise.all([
waitForConditionOrAtCapacity(page, () =>
page.waitForNavigation({
waitUntil: 'networkidle0'
waitUntil: 'networkidle2',
timeout: timeoutMs
})
),
submitP()