Merge pull request #143 from waylaidwanderer/feature/improve-robustness

pull/142/head
Travis Fischer 2022-12-15 00:35:03 -06:00 zatwierdzone przez GitHub
commit 6b6de5845c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -267,10 +267,18 @@ export class ChatGPTAPIBrowser {
const lastMessage = await this.getLastMessage()
message = message.replace('\n', '\t')
await inputBox.focus()
await inputBox.type(message, { delay: 0 })
await inputBox.press('Enter')
const paragraphs = message.split('\n')
for (let i = 0; i < paragraphs.length; i++) {
await inputBox.type(paragraphs[i], { delay: 0 })
if (i < paragraphs.length - 1) {
await this._page.keyboard.down('Shift')
await inputBox.press('Enter')
await this._page.keyboard.up('Shift')
} else {
await inputBox.press('Enter')
}
}
do {
await delay(1000)