Skip to content

Add AutoGPT support#9

Closed
metatarz wants to merge 2 commits intomayt:masterfrom
metatarz:metatarz/auto-gpt
Closed

Add AutoGPT support#9
metatarz wants to merge 2 commits intomayt:masterfrom
metatarz:metatarz/auto-gpt

Conversation

@metatarz
Copy link
Copy Markdown
Contributor

@metatarz metatarz commented Dec 6, 2023

#10 This PR allows users to opt in autogpt. It basically breaksdown the doAction function into generate playwright code, execute code and get site overview tools.
I thought it would be useful to share for users seeking to achieve more complex tasks.

Copy link
Copy Markdown
Owner

@mayt mayt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like something is off with the execute part of the code too. It doesn't seem to update browser. I'll take a second pass

return cleanedCommands;
}

async function getPlayWrightCode(task) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you can to pass in chatApi and page here

You are on the website ${page.evaluate('location.href')}

Here is the overview of the site
${await parseSite(page, options)}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the options here is also not defined. You can remove it for now.

name: 'get playwright code',
description:
'useful for when you need to get playwright code. Returns the playwright code to execute',
func: async (task) => getPlayWrightCode(task),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have to await on getPlayWrightCode(task)?

}
}

let page; // declare here for global reference
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like you dont need this if you pass it in below

try {
await doAction(chatApi, page, task, options);
if (options.autogpt) {
await doAutoGPTAction(chatApi, task);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await doAutoGPTAction(chatApi, task);
await doAutoGPTAction(page, chatApi, task, option);

you can pass page and option in here too.

@mayt
Copy link
Copy Markdown
Owner

mayt commented Dec 14, 2023

I took liberty and took your coded and expanded the autogpt integration.

See the PR at #14

If you would mind, I'll close this PR

@mayt mayt closed this Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants