Commit 13e9e3e0 authored by Travis Fischer's avatar Travis Fischer Committed by GitHub

Merge pull request #10 from brunoocal/main

parents d57c011c e3355dd9
...@@ -187,6 +187,14 @@ export class ChatGPTAPI { ...@@ -187,6 +187,14 @@ export class ChatGPTAPI {
} while (true) } 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() { async close() {
await this._browser.close() await this._browser.close()
this._page = null this._page = null
......
...@@ -47,9 +47,16 @@ async function main() { ...@@ -47,9 +47,16 @@ async function main() {
// Wait forever; useful for debugging chromium sessions // Wait forever; useful for debugging chromium sessions
// await new Promise(() => {}) // 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() await api.close()
return response return newResponse
} }
main().then((res) => { main().then((res) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment