Changeset 0.28.5 (#191)
This commit is contained in:
@@ -1124,7 +1124,31 @@ const UI = {
|
||||
// Normal content delta
|
||||
const delta = parsed.choices?.[0]?.delta?.content || '';
|
||||
if (delta) {
|
||||
content += delta;
|
||||
// ── v0.28.5: Stream pipe ────────────────────
|
||||
if (typeof sw !== 'undefined' && sw.pipe) {
|
||||
const streamCtx = {
|
||||
chunk: delta,
|
||||
accumulated: content + delta,
|
||||
channel: {
|
||||
id: App.activeId || null,
|
||||
type: App.activeType || 'direct',
|
||||
},
|
||||
model: App.settings?.model || '',
|
||||
event: currentEvent || 'content',
|
||||
tokens: { input: 0, output: content.length + delta.length },
|
||||
};
|
||||
const result = sw.pipe._runStream(streamCtx);
|
||||
if (result === null) {
|
||||
// Chunk dropped by filter
|
||||
currentEvent = '';
|
||||
continue;
|
||||
}
|
||||
// Use filter's accumulated (may differ from simple append)
|
||||
content = result.accumulated;
|
||||
} else {
|
||||
content += delta;
|
||||
}
|
||||
|
||||
const full = (reasoning ? '<think>' + reasoning + '</think>' : '') + content;
|
||||
if (activeContentEl) activeContentEl.innerHTML = formatMessage(full);
|
||||
this._scrollToBottom();
|
||||
|
||||
Reference in New Issue
Block a user