Add resetThread() function

pull/10/head
Bruno Cal 2022-12-05 02:14:23 -03:00
rodzic 549e9b4929
commit e3355dd9f4
2 zmienionych plików z 16 dodań i 1 usunięć

Wyświetl plik

@ -187,6 +187,14 @@ export class ChatGPTAPI {
} while (true)
}
async resetThread() {
const resetButton = await this._page.$('nav > a:nth-child(1)')
if (!resetButton) throw new Error('not signed in')
await resetButton.click()
}
async close() {
await this._browser.close()
this._page = null

Wyświetl plik

@ -47,9 +47,16 @@ async function main() {
// Wait forever; useful for debugging chromium sessions
// await new Promise(() => {})
await api.resetThread()
const newResponse = await api.sendMessage(
// 'Write a TypeScript function for conway sort.'
'Write a javascript version of bubble sort. Do not include example usage.'
)
await api.close()
return response
return newResponse
}
main().then((res) => {