Spaces:
Paused
Paused
matt HOFFNER commited on
Commit ·
d73f75f
1
Parent(s): f7857c1
debug
Browse files- src/app/search/web/page.jsx +1 -0
- src/pages/api/stream.js +3 -0
src/app/search/web/page.jsx
CHANGED
|
@@ -31,6 +31,7 @@ export default function WebSearchPage({ searchParams }) {
|
|
| 31 |
return;
|
| 32 |
}
|
| 33 |
responseText += decoder.decode(value);
|
|
|
|
| 34 |
setAiResponse(responseText);
|
| 35 |
return reader.read().then(processText);
|
| 36 |
});
|
|
|
|
| 31 |
return;
|
| 32 |
}
|
| 33 |
responseText += decoder.decode(value);
|
| 34 |
+
console.log(responseText);
|
| 35 |
setAiResponse(responseText);
|
| 36 |
return reader.read().then(processText);
|
| 37 |
});
|
src/pages/api/stream.js
CHANGED
|
@@ -71,6 +71,9 @@ export const LLMStream = async (
|
|
| 71 |
console.log(event);
|
| 72 |
const data = event.data;
|
| 73 |
try {
|
|
|
|
|
|
|
|
|
|
| 74 |
const json = JSON.parse(data);
|
| 75 |
if (json.choices[0].finish_reason === "stop") {
|
| 76 |
controller.close();
|
|
|
|
| 71 |
console.log(event);
|
| 72 |
const data = event.data;
|
| 73 |
try {
|
| 74 |
+
if (data === '[DONE]') {
|
| 75 |
+
return;
|
| 76 |
+
}
|
| 77 |
const json = JSON.parse(data);
|
| 78 |
if (json.choices[0].finish_reason === "stop") {
|
| 79 |
controller.close();
|