Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: enable js for google search tool #367

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

njhale
Copy link
Member

@njhale njhale commented Jan 24, 2025

Enable Javascript when gathering page content in the Google Search tool. This allows more content to be extracted from web pages that require Javascript to load properly.

Addresses part of obot-platform/obot#1423

Copy link
Contributor

@ryanhopperlowe ryanhopperlowe left a comment

Choose a reason for hiding this comment

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

1 nit, but LGTM

const foundURLs = new Set<string>()
const results: Array<Promise<SearchResult | null>> = []

const page = await context.newPage()
const noJSPages = await Promise.all(
const pages = await Promise.all(
Array.from({ length: maxResults }, async () => {
Copy link
Contributor

@ryanhopperlowe ryanhopperlowe Jan 24, 2025

Choose a reason for hiding this comment

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

nit: you can remove async/await from this since you're returning a promise from the array generator callback

const pages = await Promise.all(
    Array.from({ length: maxResults }, () => context.newPage())
)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the callout here. Fixed!

Enable Javascript when gathering page content in the `Google Search`
tool. This allows more content to be extracted from web pages that
require Javascript to load properly.

Signed-off-by: Nick Hale <[email protected]>
@njhale njhale force-pushed the enhance/google-search-enable-js branch from c71af5e to 6cb3c5c Compare January 24, 2025 01:04
@njhale njhale merged commit a517823 into obot-platform:main Jan 24, 2025
1 check passed
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