Files
KrisHD_AI/src/services/streamEvents.js
T
Fretux c48e1b17c4
CI / check (22) (push) Successful in 10m3s
CI / check (24) (push) Successful in 9m34s
Fix admin authorization and harden chat requests
2026-10-05 22:49:29 +02:00

9 lines
435 B
JavaScript

/** Translate model callbacks to small wire events, including corrective-pass resets. */
export function createTextStreamEvents(sendEvent) {
const emit = (event, target) => (chunk, fullText) => {
if (chunk === "" && fullText === "") sendEvent("replace", {target, text: ""});
else if (chunk) sendEvent(event, {chunk});
};
return {onChunk: emit("chunk", "reply"), onThinking: emit("thinking", "thinking")};
}