This commit is contained in:
Frank 2025-08-17 17:18:22 +08:00
parent bc199d32be
commit 24f0f81773

View file

@ -452,8 +452,6 @@ async function subscribeSessionEvents() {
const response = await fetch(`${server.url}/event`)
if (!response.body) throw new Error("No response body")
// TODO
console.log("!@#!@#!@#! fetched", response.body)
const reader = response.body.getReader()
const decoder = new TextDecoder()
@ -465,10 +463,10 @@ async function subscribeSessionEvents() {
if (done) break
const chunk = decoder.decode(value, { stream: true })
console.log("!@#!@#!@#! read", chunk)
const lines = chunk.split("\n")
for (const line of lines) {
// TODO
console.log("!@#!@#!@#! line", line)
if (!line.startsWith("data: ")) continue
@ -478,7 +476,7 @@ async function subscribeSessionEvents() {
try {
const evt = JSON.parse(jsonStr)
if (evt.type !== "part.updated") continue
if (evt.type !== "message.part.updated") continue
if (evt.properties.part.sessionID !== session.id) continue
const part = evt.properties.part