Skip to content

Commit 79fd382

Browse files
committed
Try with Uint8Array
1 parent e5bb89a commit 79fd382

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/gitbook/src/routes/llms-full.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function serveLLMsFullTxt(context: GitBookSiteContext) {
3232
}
3333

3434
return new Response(
35-
new ReadableStream({
35+
new ReadableStream<Uint8Array>({
3636
async pull(controller) {
3737
await streamMarkdownFromSiteStructure(context, controller);
3838
controller.close();
@@ -51,7 +51,7 @@ export async function serveLLMsFullTxt(context: GitBookSiteContext) {
5151
*/
5252
async function streamMarkdownFromSiteStructure(
5353
context: GitBookSiteContext,
54-
stream: ReadableStreamDefaultController<string>
54+
stream: ReadableStreamDefaultController<Uint8Array>
5555
): Promise<void> {
5656
switch (context.structure.type) {
5757
case 'sections':
@@ -72,7 +72,7 @@ async function streamMarkdownFromSiteStructure(
7272
*/
7373
async function streamMarkdownFromSections(
7474
context: GitBookSiteContext,
75-
stream: ReadableStreamDefaultController<string>,
75+
stream: ReadableStreamDefaultController<Uint8Array>,
7676
siteSections: SiteSection[]
7777
): Promise<void> {
7878
for (const siteSection of siteSections) {
@@ -90,7 +90,7 @@ async function streamMarkdownFromSections(
9090
*/
9191
async function streamMarkdownFromSiteSpaces(
9292
context: GitBookSiteContext,
93-
stream: ReadableStreamDefaultController<string>,
93+
stream: ReadableStreamDefaultController<Uint8Array>,
9494
siteSpaces: SiteSpace[],
9595
basePath: string
9696
): Promise<void> {
@@ -128,7 +128,7 @@ async function streamMarkdownFromSiteSpaces(
128128
concurrency: MAX_CONCURRENCY,
129129
}
130130
)) {
131-
stream.enqueue(markdown);
131+
stream.enqueue(new TextEncoder().encode(markdown));
132132
}
133133
}
134134
}

0 commit comments

Comments
 (0)