kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: timeouts for browser
rodzic
504d8d513b
commit
025f9682e4
|
@ -262,7 +262,10 @@ export class ChatGPTAPIBrowser {
|
||||||
|
|
||||||
const markdownMessages = htmlMessages.map((messageHtml) => {
|
const markdownMessages = htmlMessages.map((messageHtml) => {
|
||||||
// parse markdown from message HTML
|
// 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, {
|
return html2md(messageHtml, {
|
||||||
ignoreTags: [
|
ignoreTags: [
|
||||||
'button',
|
'button',
|
||||||
|
|
|
@ -71,7 +71,7 @@ export async function getOpenAIAuth({
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.goto('https://chat.openai.com/auth/login', {
|
await page.goto('https://chat.openai.com/auth/login', {
|
||||||
waitUntil: 'networkidle0'
|
waitUntil: 'networkidle2'
|
||||||
})
|
})
|
||||||
|
|
||||||
// NOTE: this is where you may encounter a CAPTCHA
|
// 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
|
// click login button and wait for navigation to finish
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForNavigation({
|
page.waitForNavigation({
|
||||||
waitUntil: 'networkidle0'
|
waitUntil: 'networkidle2',
|
||||||
|
timeout: timeoutMs
|
||||||
}),
|
}),
|
||||||
|
|
||||||
page.click('#__next .btn-primary')
|
page.click('#__next .btn-primary')
|
||||||
|
@ -134,7 +135,8 @@ export async function getOpenAIAuth({
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
waitForConditionOrAtCapacity(page, () =>
|
waitForConditionOrAtCapacity(page, () =>
|
||||||
page.waitForNavigation({
|
page.waitForNavigation({
|
||||||
waitUntil: 'networkidle0'
|
waitUntil: 'networkidle2',
|
||||||
|
timeout: timeoutMs
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
submitP()
|
submitP()
|
||||||
|
|
Ładowanie…
Reference in New Issue