Keep the handoff continuation message when its turn is folded away
This commit is contained in:
+4
-1
@@ -67,6 +67,7 @@ type Ctx = {
|
||||
taskId: string | undefined;
|
||||
lastMessage: HTMLElement | undefined;
|
||||
turnStart: HTMLElement | undefined;
|
||||
keepTurnStart: boolean;
|
||||
quiet: boolean;
|
||||
handoff: { summary: HTMLElement; body: HTMLElement } | undefined;
|
||||
watchReport: (el: HTMLElement, itemId: string) => void;
|
||||
@@ -237,6 +238,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
unplaced: [],
|
||||
lastMessage: undefined,
|
||||
turnStart: undefined,
|
||||
keepTurnStart: false,
|
||||
quiet: false,
|
||||
handoff: undefined,
|
||||
root: src.root(),
|
||||
@@ -529,7 +531,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
openHandoff();
|
||||
}
|
||||
if (ev.kind === "turn.ended" && ctx.quiet && ctx.turnStart?.parentNode === transcript) {
|
||||
let node: ChildNode | null = ctx.turnStart;
|
||||
let node: ChildNode | null = ctx.keepTurnStart ? ctx.turnStart.nextSibling : ctx.turnStart;
|
||||
while (node && node !== spinner) {
|
||||
const next: ChildNode | null = node.nextSibling;
|
||||
node.remove();
|
||||
@@ -542,6 +544,7 @@ export function mountChat(root: HTMLElement, src: ChatSource, makeHead: (rerende
|
||||
put(el);
|
||||
if (ev.kind === "user.message" && p["mid_turn"] !== true) {
|
||||
ctx.turnStart = el;
|
||||
ctx.keepTurnStart = p["continuation"] === true;
|
||||
}
|
||||
if (ev.kind === "turn.ended" || ev.kind === "inbox.created") {
|
||||
addAnchor(ev.seq, el, ev.kind === "turn.ended");
|
||||
|
||||
Reference in New Issue
Block a user