Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
@@ -507,8 +507,10 @@ async function handleStreamResponse(response, model, res) {
|
|
507 |
if (!line.trim()) continue;
|
508 |
const trimmedLine = line.trim();
|
509 |
if (trimmedLine.startsWith('data: ')) {
|
510 |
-
const
|
511 |
try {
|
|
|
|
|
512 |
const linejosn = JSON.parse(content);
|
513 |
if (linejosn?.error?.name === "RateLimitError") {
|
514 |
var responseData = MessageProcessor.createChatResponse(`${linejosn.error.name},请重新对话`, model, true);
|
|
|
507 |
if (!line.trim()) continue;
|
508 |
const trimmedLine = line.trim();
|
509 |
if (trimmedLine.startsWith('data: ')) {
|
510 |
+
const data = trimmedLine.substring(6);
|
511 |
try {
|
512 |
+
var content = data.trim();
|
513 |
+
if(!content)continue;
|
514 |
const linejosn = JSON.parse(content);
|
515 |
if (linejosn?.error?.name === "RateLimitError") {
|
516 |
var responseData = MessageProcessor.createChatResponse(`${linejosn.error.name},请重新对话`, model, true);
|