Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
1f600c2d
authored
May 26, 2026
by
DigHuang
Committed by
GitHub
May 26, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(service): convert web readable stream to node stream in text2Speech (#6985)
parent
19435e58
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
+6
-1
packages/service/core/ai/audio/speech.ts
+6
-1
No files found.
packages/service/core/ai/audio/speech.ts
View file @
1f600c2d
import
type
{
NextApiResponse
}
from
'next'
;
import
type
{
NextApiResponse
}
from
'next'
;
import
{
getAIApi
}
from
'../config'
;
import
{
getAIApi
}
from
'../config'
;
import
{
getTTSModel
}
from
'../model'
;
import
{
getTTSModel
}
from
'../model'
;
import
{
Readable
}
from
'stream'
;
export
async
function
text2Speech
({
export
async
function
text2Speech
({
res
,
res
,
...
@@ -40,7 +41,11 @@ export async function text2Speech({
...
@@ -40,7 +41,11 @@ export async function text2Speech({
:
{}
:
{}
);
);
const
readableStream
=
response
.
body
as
unknown
as
NodeJS
.
ReadableStream
;
if
(
!
response
.
body
)
{
throw
new
Error
(
'Response body is empty'
);
}
const
readableStream
=
Readable
.
fromWeb
(
response
.
body
as
Parameters
<
typeof
Readable
.
fromWeb
>
[
0
]);
readableStream
.
pipe
(
res
);
readableStream
.
pipe
(
res
);
const
chunks
:
Uint8Array
[]
=
[];
const
chunks
:
Uint8Array
[]
=
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment