mirror of
https://github.com/missuo/FreeGPT35.git
synced 2025-10-13 13:58:14 +00:00
fix: 🐛 Heartbeat data skipped every 15 (#29)
Fix axios library does not support http2 heartbeat data causing errors, manually skip the time string of heartbeat data Co-authored-by: cliouo <cliouo@163.com>
This commit is contained in:
3
app.js
3
app.js
@@ -161,6 +161,9 @@ async function handleChatCompletion(req, res) {
|
||||
let created = Date.now();
|
||||
|
||||
for await (const message of StreamCompletion(response.data)) {
|
||||
// Skip heartbeat detection
|
||||
if (message.match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{6}$/)) continue;
|
||||
|
||||
const parsed = JSON.parse(message);
|
||||
|
||||
let content = parsed?.message?.content?.parts[0] || "";
|
||||
|
Reference in New Issue
Block a user