feat: container

This commit is contained in:
Acbox
2026-01-15 20:10:37 +08:00
parent 31d8103ed2
commit 9ee8b19475
24 changed files with 1527 additions and 53 deletions
+7
View File
@@ -83,6 +83,7 @@ async function performStreamChat(
}
let buffer = ''
let receivedDone = false
while (true) {
const { done, value } = await reader.read()
@@ -99,6 +100,7 @@ async function performStreamChat(
const data = line.slice(6).trim()
if (data === '[DONE]') {
receivedDone = true
await onEvent({ type: 'done' })
return
}
@@ -119,6 +121,11 @@ async function performStreamChat(
}
}
}
// If stream ended without [DONE], it's an error
if (!receivedDone) {
throw new Error('Connection closed unexpectedly - stream ended without completion signal')
}
}
/**