(url, settings)
| 107 | } |
| 108 | |
| 109 | async function crawl(url, settings) { |
| 110 | const response = await fetch(new URL(`/${url}`, JinaReaderURL), { |
| 111 | headers: settings.jinaApiKey ? { |
| 112 | Authorization: `Bearer ${settings.jinaApiKey}` |
| 113 | } : undefined |
| 114 | }) |
| 115 | if (!response.ok) { |
| 116 | throw new Error(`Failed to crawl: ${response.statusText}`) |
| 117 | } |
| 118 | return await response.text() |
| 119 | } |
| 120 | |
| 121 | const pluginId = 'aiaw-web' |
| 122 |