mirror of
https://github.com/PawanOsman/ChatGPT.git
synced 2026-06-02 06:14:25 +02:00
fix: 🐛 Heartbeat data skipped every 15
Fix axios library does not support http2 heartbeat data causing errors, manually skip the time string of heartbeat data
This commit is contained in:
@@ -149,6 +149,10 @@ async function handleChatCompletion(req: Request, res: Response) {
|
||||
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