@eyeclaw/eyeclaw 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/websocket-client.ts +7 -1
package/package.json
CHANGED
package/src/websocket-client.ts
CHANGED
|
@@ -231,7 +231,11 @@ export class EyeClawWebSocketClient {
|
|
|
231
231
|
// 解析 SSE 流式响应
|
|
232
232
|
while (true) {
|
|
233
233
|
const { done, value } = await reader.read()
|
|
234
|
-
if (done)
|
|
234
|
+
if (done) {
|
|
235
|
+
// 流结束,通知 Rails
|
|
236
|
+
this.sendMessage('stream_end', { session_id: sessionId })
|
|
237
|
+
break
|
|
238
|
+
}
|
|
235
239
|
|
|
236
240
|
buffer += decoder.decode(value, { stream: true })
|
|
237
241
|
const lines = buffer.split('\n')
|
|
@@ -270,6 +274,8 @@ export class EyeClawWebSocketClient {
|
|
|
270
274
|
// stream_end 事件:流结束(由 HTTP handler 发送)
|
|
271
275
|
if (currentEvent === 'stream_end') {
|
|
272
276
|
this.api.logger.info(`[EyeClaw] Stream ended: ${eventData.stream_id}`)
|
|
277
|
+
// 通知 Rails 流已结束
|
|
278
|
+
this.sendMessage('stream_end', { session_id: sessionId })
|
|
273
279
|
}
|
|
274
280
|
|
|
275
281
|
// stream_error 事件:错误
|