mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-10 12:10:40 +00:00
attempt to fix browser rendering
This commit is contained in:
parent
d70c0887d5
commit
7ff228f576
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import { CloudflareVectorizeStore } from '@langchain/cloudflare';
|
|||
import { Request } from '@cloudflare/workers-types';
|
||||
import puppeteer from '@cloudflare/puppeteer';
|
||||
|
||||
// TODO: THIS DOESN'T WORK PROPERLY. FOR EG, FOR THIS URL https://dev.to/challenges/cloudflare, IT DOESN'T RETURN FULL CONTENT
|
||||
export async function GET(request: Request, _: CloudflareVectorizeStore, embeddings: OpenAIEmbeddings, model: GenerativeModel, env?: Env) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
let url = searchParams.get('url');
|
||||
|
|
@ -14,7 +15,8 @@ export async function GET(request: Request, _: CloudflareVectorizeStore, embeddi
|
|||
const page = await browser.newPage();
|
||||
await page.goto(url);
|
||||
|
||||
// Innertext of content
|
||||
await page.waitForSelector('body');
|
||||
|
||||
const contentElement = await page.$('body');
|
||||
const content = await page.evaluate((element) => element.innerText, contentElement);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue