@@ -32,7 +32,7 @@ export async function serveLLMsFullTxt(context: GitBookSiteContext) {
32
32
}
33
33
34
34
return new Response (
35
- new ReadableStream ( {
35
+ new ReadableStream < Uint8Array > ( {
36
36
async pull ( controller ) {
37
37
await streamMarkdownFromSiteStructure ( context , controller ) ;
38
38
controller . close ( ) ;
@@ -51,7 +51,7 @@ export async function serveLLMsFullTxt(context: GitBookSiteContext) {
51
51
*/
52
52
async function streamMarkdownFromSiteStructure (
53
53
context : GitBookSiteContext ,
54
- stream : ReadableStreamDefaultController < string >
54
+ stream : ReadableStreamDefaultController < Uint8Array >
55
55
) : Promise < void > {
56
56
switch ( context . structure . type ) {
57
57
case 'sections' :
@@ -72,7 +72,7 @@ async function streamMarkdownFromSiteStructure(
72
72
*/
73
73
async function streamMarkdownFromSections (
74
74
context : GitBookSiteContext ,
75
- stream : ReadableStreamDefaultController < string > ,
75
+ stream : ReadableStreamDefaultController < Uint8Array > ,
76
76
siteSections : SiteSection [ ]
77
77
) : Promise < void > {
78
78
for ( const siteSection of siteSections ) {
@@ -90,7 +90,7 @@ async function streamMarkdownFromSections(
90
90
*/
91
91
async function streamMarkdownFromSiteSpaces (
92
92
context : GitBookSiteContext ,
93
- stream : ReadableStreamDefaultController < string > ,
93
+ stream : ReadableStreamDefaultController < Uint8Array > ,
94
94
siteSpaces : SiteSpace [ ] ,
95
95
basePath : string
96
96
) : Promise < void > {
@@ -128,7 +128,7 @@ async function streamMarkdownFromSiteSpaces(
128
128
concurrency : MAX_CONCURRENCY ,
129
129
}
130
130
) ) {
131
- stream . enqueue ( markdown ) ;
131
+ stream . enqueue ( new TextEncoder ( ) . encode ( markdown ) ) ;
132
132
}
133
133
}
134
134
}
0 commit comments