diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-16 12:41:45 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2024-08-16 12:41:45 -0400 |
| commit | f2eac77e4073ec06ab0cccca9aa8f98916f62d5b (patch) | |
| tree | ccf11ae5a7d5afe6df1fa307e7fbc30f696de082 /src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts | |
| parent | 6f9b8f9b393d411a17f7954b6cc36618efe698e2 (diff) | |
Webscraping works with Screenshot API
Diffstat (limited to 'src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts')
| -rw-r--r-- | src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts b/src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts index 59fd47b7a..c59afefbd 100644 --- a/src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts +++ b/src/client/views/nodes/ChatBox/tools/WebsiteInfoScraperTool.ts @@ -24,10 +24,19 @@ export class WebsiteInfoScraperTool extends BaseTool<{ url: string }> { async execute(args: { url: string }): Promise<any> { try { - const { html } = await Networking.PostToServer('/scrapeWebsite', { url: args.url }); + const { website_image_base64 } = await Networking.PostToServer('/scrapeWebsite', { url: args.url }); const id = uuidv4(); this._addLinkedUrlDoc(args.url, id); - return [{ type: 'text', text: `<chunk chunk_id=${id} chunk_type=text> ${html} </chunk>` }]; + return [ + { type: 'text', text: `<chunk chunk_id=${id} chunk_type=url> ` }, + { + type: 'image_url', + image_url: { + url: `data:image/jpeg;base64,${website_image_base64}`, + }, + }, + { type: 'text', text: `</chunk>\n` }, + ]; } catch (error) { return [{ type: 'text', text: 'An error occurred while scraping the website.' }]; } |
