fix(session): type message list not found errors (#27275)

This commit is contained in:
Shoubhit Dash
2026-05-13 13:22:12 +05:30
committed by GitHub
parent fed043a1ad
commit f01c6b3e37
9 changed files with 95 additions and 23 deletions

View File

@@ -1077,7 +1077,9 @@ NOTE: At any point in time through this workflow you should feel free to ask the
...(current.model.variant && current.model.variant !== "default" ? { variant: current.model.variant } : {}),
}
}
const match = yield* sessions.findMessage(sessionID, (m) => m.info.role === "user" && !!m.info.model)
const match = yield* sessions
.findMessage(sessionID, (m) => m.info.role === "user" && !!m.info.model)
.pipe(Effect.orDie)
if (Option.isSome(match) && match.value.info.role === "user") return match.value.info.model
return yield* provider.defaultModel()
})
@@ -1615,9 +1617,9 @@ NOTE: At any point in time through this workflow you should feel free to ask the
)
const lastAssistant = Effect.fnUntraced(function* (sessionID: SessionID) {
const match = yield* sessions.findMessage(sessionID, (m) => m.info.role !== "user")
const match = yield* sessions.findMessage(sessionID, (m) => m.info.role !== "user").pipe(Effect.orDie)
if (Option.isSome(match)) return match.value
const msgs = yield* sessions.messages({ sessionID, limit: 1 })
const msgs = yield* sessions.messages({ sessionID, limit: 1 }).pipe(Effect.orDie)
if (msgs.length > 0) return msgs[0]
throw new Error("Impossible")
})