diff options
| author | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-11 17:18:18 -0400 |
|---|---|---|
| committer | A.J. Shulman <Shulman.aj@gmail.com> | 2025-05-11 17:18:18 -0400 |
| commit | e141307dbd9b951f76c908610e7b89e296ad92b8 (patch) | |
| tree | a48d7cae7a7702519d2099dfff5a503fcfc7875f /src/client/views/nodes/chatbot/tools/SearchTool.ts | |
| parent | e5cb67b92d9b3c84dc90b1e64cc7128621523801 (diff) | |
chanegd everything to be more consistent
- made both web related tools use doc manager and chunk Ids
Diffstat (limited to 'src/client/views/nodes/chatbot/tools/SearchTool.ts')
| -rw-r--r-- | src/client/views/nodes/chatbot/tools/SearchTool.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/client/views/nodes/chatbot/tools/SearchTool.ts b/src/client/views/nodes/chatbot/tools/SearchTool.ts index 53f5fc109..43f14ea83 100644 --- a/src/client/views/nodes/chatbot/tools/SearchTool.ts +++ b/src/client/views/nodes/chatbot/tools/SearchTool.ts @@ -48,19 +48,21 @@ export class SearchTool extends BaseTool<SearchToolParamsType> { query, max_results: this._max_results, })) as { results: { url: string; snippet: string }[] }; - const data = results.map((result: { url: string; snippet: string }) => { - // Create a web document with the URL - const id = this._docManager.createDocInDash('web', result.url, { - title: `Search Result: ${result.url}`, - text_html: result.snippet, - data_useCors: true, - }); + const data = await Promise.all( + results.map(async (result: { url: string; snippet: string }) => { + // Create a web document with the URL + const id = await this._docManager.createDocInDash('web', result.url, { + title: `Search Result: ${result.url}`, + text_html: result.snippet, + data_useCors: true, + }); - return { - type: 'text' as const, - text: `<chunk chunk_id="${id}" chunk_type="url"><url>${result.url}</url><overview>${result.snippet}</overview></chunk>`, - }; - }); + return { + type: 'text' as const, + text: `<chunk chunk_id="${id}" chunk_type="url"><url>${result.url}</url><overview>${result.snippet}</overview></chunk>`, + }; + }) + ); return data; } catch (error) { console.log(error); |
