-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new AI.toMarkdown() method #3604
base: main
Are you sure you want to change the base?
Conversation
src/cloudflare/internal/ai-api.ts
Outdated
data: btoa( | ||
String.fromCharCode(...new Uint8Array(await file.blob.arrayBuffer())) | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels extremely convoluted. I believe you ought to be able to make use of internal-node:internal-buffer
here and just use Buffer.from(await file.blob.arrayBuffer()).toString('base64'))
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this import as you are suggesting import { Buffer } from 'internal-node:internal-buffer';
throws this error: src/cloudflare/internal/ai-api.ts(6,24): error TS2307: Cannot find module 'internal-node:internal-buffer' or its corresponding type declarations.
I didn't find any other cloudflare/*
file importing anything from internal-node
so it might be a simple configuration missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation limits the length of the string to 65k. Using spread operator means that you are bounded by the V8's argument limitation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would prefer to use the internal-node
version, but I'm unable to import it using import { Buffer } from 'internal-node:internal-buffer';
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to import the Buffer class, so i changed the implementation to stop using the spread operator, this should bypass the 65k limit
56108de
to
9080063
Compare
src/cloudflare/internal/ai-api.ts
Outdated
data: btoa( | ||
String.fromCharCode(...new Uint8Array(await file.blob.arrayBuffer())) | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation limits the length of the string to 65k. Using spread operator means that you are bounded by the V8's argument limitation.
e7c7ee3
to
0c96292
Compare
0c96292
to
45a8dbd
Compare
No description provided.