fix(session): persist interrupted streamed text
parent
2d6d788db5
commit
ce8e9b1d84
|
|
@ -48,8 +48,8 @@ export namespace SessionProcessor {
|
|||
needsCompaction = false
|
||||
const shouldBreak = (await Config.get()).experimental?.continue_loop_on_deny !== true
|
||||
while (true) {
|
||||
let currentText: MessageV2.TextPart | undefined
|
||||
try {
|
||||
let currentText: MessageV2.TextPart | undefined
|
||||
let reasoningMap: Record<string, MessageV2.ReasoningPart> = {}
|
||||
const stream = await LLM.stream(streamInput)
|
||||
|
||||
|
|
@ -385,6 +385,15 @@ export namespace SessionProcessor {
|
|||
SessionStatus.set(input.sessionID, { type: "idle" })
|
||||
}
|
||||
}
|
||||
if (currentText) {
|
||||
currentText.text = currentText.text.trimEnd()
|
||||
currentText.time = {
|
||||
start: currentText.time?.start ?? Date.now(),
|
||||
end: Date.now(),
|
||||
}
|
||||
await Session.updatePart(currentText)
|
||||
currentText = undefined
|
||||
}
|
||||
if (snapshot) {
|
||||
const patch = await Snapshot.patch(snapshot)
|
||||
if (patch.files.length) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue