Spaces:
Running
Running
muxi feng
commited on
Commit
·
66b8e19
1
Parent(s):
a08e190
修复猴狐逆向流式响应问题
Browse files- app/api/lemur/route.ts +3 -2
app/api/lemur/route.ts
CHANGED
@@ -99,8 +99,9 @@ async function createStream(res: Response) {
|
|
99 |
// console.log(data)
|
100 |
if (event.id == "1") {
|
101 |
let text1 = data.slice(data.indexOf("content"));
|
102 |
-
const text = text1.slice(
|
103 |
-
|
|
|
104 |
controller.enqueue(queue);
|
105 |
return;
|
106 |
}
|
|
|
99 |
// console.log(data)
|
100 |
if (event.id == "1") {
|
101 |
let text1 = data.slice(data.indexOf("content"));
|
102 |
+
const text = text1.slice(text1.indexOf("data")+6,text1.indexOf("code")-7);
|
103 |
+
// console.log("123"+text.replaceAll('\\',''))
|
104 |
+
const queue = encoder.encode(JSON.parse(text.replaceAll('\\','')).choices[0].delta.content);
|
105 |
controller.enqueue(queue);
|
106 |
return;
|
107 |
}
|