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
c6a5f163
authored
Apr 26, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: stream
parent
7ed3c91a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/service/utils/openai.ts
+2
-2
No files found.
src/service/utils/openai.ts
View file @
c6a5f163
...
...
@@ -146,13 +146,13 @@ export const gpt35StreamResponse = ({
const
decoder
=
new
TextDecoder
();
try
{
const
parser
=
createParser
(
onParse
);
for
await
(
const
chunk
of
chatResponse
.
data
as
any
)
{
if
(
stream
.
destroyed
)
{
// 流被中断了,直接忽略后面的内容
break
;
}
const
parser
=
createParser
(
onParse
);
parser
.
feed
(
decoder
.
decode
(
chunk
));
parser
.
feed
(
decoder
.
decode
(
chunk
,
{
stream
:
true
}));
}
}
catch
(
error
)
{
console
.
log
(
'pipe error'
,
error
);
...
...
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