From 596502c232ea6b6b88c3c58486e139074ea056ff Mon Sep 17 00:00:00 2001 From: "A.J. Shulman" Date: Tue, 15 Oct 2024 14:18:44 -0400 Subject: tried something for typechecking but way too overcomplicated --- src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts') diff --git a/src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts b/src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts index 1efb389b8..8a4181b43 100644 --- a/src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts +++ b/src/client/views/nodes/chatbot/tools/WebsiteInfoScraperTool.ts @@ -1,6 +1,7 @@ import { v4 as uuidv4 } from 'uuid'; import { Networking } from '../../../../Network'; import { BaseTool } from './BaseTool'; +import { Observation } from '../types/types'; export class WebsiteInfoScraperTool extends BaseTool<{ url: string | string[] }> { private _addLinkedUrlDoc: (url: string, id: string) => void; @@ -63,16 +64,16 @@ export class WebsiteInfoScraperTool extends BaseTool<{ url: string | string[] }> this._addLinkedUrlDoc = addLinkedUrlDoc; } - async execute(args: { url: string | string[] }): Promise { + async execute(args: { url: string | string[] }): Promise { const urls = Array.isArray(args.url) ? args.url : [args.url]; - const results = []; + const results: Observation[] = []; for (const url of urls) { try { const { website_plain_text } = await Networking.PostToServer('/scrapeWebsite', { url }); const id = uuidv4(); this._addLinkedUrlDoc(url, id); - results.push({ type: 'text', text: `\n${website_plain_text}\n\n` }); + results.push({ type: 'text', text: `\n${website_plain_text}\n` }); } catch (error) { console.log(error); results.push({ type: 'text', text: `An error occurred while scraping the website: ${url}` }); -- cgit v1.2.3-70-g09d2