feat: cache lastPreview in processOutputLine
This commit is contained in:
parent
b4df1a49b2
commit
8f7491bfaa
|
|
@ -259,6 +259,12 @@ export class FanoutController {
|
||||||
const msg = event.message as Message;
|
const msg = event.message as Message;
|
||||||
if (msg.role === "assistant") {
|
if (msg.role === "assistant") {
|
||||||
// Cache latest assistant text for live preview
|
// Cache latest assistant text for live preview
|
||||||
|
for (const part of msg.content) {
|
||||||
|
if (part.type === "text") {
|
||||||
|
job.lastPreview = part.text.length > 500 ? part.text.slice(0, 500) + "…" : part.text;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
job.usage.turns++;
|
job.usage.turns++;
|
||||||
const usage = msg.usage;
|
const usage = msg.usage;
|
||||||
if (usage) {
|
if (usage) {
|
||||||
|
|
@ -272,13 +278,6 @@ export class FanoutController {
|
||||||
if (msg.stopReason) job.stopReason = msg.stopReason;
|
if (msg.stopReason) job.stopReason = msg.stopReason;
|
||||||
if (msg.errorMessage) job.errorMessage = msg.errorMessage;
|
if (msg.errorMessage) job.errorMessage = msg.errorMessage;
|
||||||
|
|
||||||
// Cache last assistant text output for live preview (capped to keep meta.json small)
|
|
||||||
for (const part of msg.content) {
|
|
||||||
if (part.type === "text") {
|
|
||||||
job.lastPreview = part.text.slice(0, 5000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.persist(job);
|
this.persist(job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -288,7 +287,7 @@ export class FanoutController {
|
||||||
if (msg.role === "assistant") {
|
if (msg.role === "assistant") {
|
||||||
for (const part of msg.content) {
|
for (const part of msg.content) {
|
||||||
if (part.type === "text") {
|
if (part.type === "text") {
|
||||||
job.lastPreview = part.text.slice(0, 5000);
|
job.lastPreview = part.text.length > 500 ? part.text.slice(0, 500) + "…" : part.text;
|
||||||
this.persist(job);
|
this.persist(job);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue