Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 6x 6x 7x 5x 2x 3x | import { NodeExecution } from "@/objects/Model";
/**
* The execution a `token_reset` frame clears the preview of: the newest
* unfinished run of the node it names, or, when it names none (or that node
* is not drawn), the newest unfinished run, which is where tokens are drawn.
* -1 when every run has finished.
*
* svc-ai sends the frame when what a node streamed was not answer: a turn
* that called tools, on a model whose text there is an account of what it
* was about to do (gpt-oss's analysis, "Let me search…"). The answer itself
* is built without it.
*/
export function resetTarget(
executions: NodeExecution[],
node?: string,
): number {
let newest = -1;
for (let i = executions.length - 1; i >= 0; i--) {
if (executions[i].done) continue;
if (!node || executions[i].node_id === node) return i;
Eif (newest < 0) newest = i;
}
return newest;
}
|