feat(chat,seahorse): persist and display model_name across history (#2897)

* feat(chat,seahorse): persist and display model_name across history

* test(seahorse): fix lint regressions in repair coverage

* fix(pico): preserve model_name in live updates

* fix(pico): preserve model_name through live stream wrappers
This commit is contained in:
LC
2026-05-20 13:42:21 +08:00
committed by GitHub
parent 548dc15acd
commit b7db059544
41 changed files with 1266 additions and 139 deletions
@@ -83,6 +83,14 @@ function parseContextUsage(
}
}
function parseModelName(payload: Record<string, unknown>): string | undefined {
if (typeof payload.model_name !== "string") {
return undefined
}
const modelName = payload.model_name.trim()
return modelName || undefined
}
export function handlePicoMessage(
message: PicoMessage,
expectedSessionId: string,
@@ -102,6 +110,7 @@ export function handlePicoMessage(
const attachments = parseAttachments(payload)
const contextUsage = parseContextUsage(payload)
const isPlaceholder = payload.placeholder === true
const modelName = parseModelName(payload)
const timestamp =
message.timestamp !== undefined &&
Number.isFinite(Number(message.timestamp))
@@ -116,6 +125,7 @@ export function handlePicoMessage(
role: "assistant",
content,
kind,
...(modelName ? { modelName } : {}),
...(toolCalls ? { toolCalls } : {}),
attachments,
timestamp,
@@ -135,6 +145,7 @@ export function handlePicoMessage(
const messageId = payload.message_id as string
const attachments = parseAttachments(payload)
const contextUsage = parseContextUsage(payload)
const modelName = parseModelName(payload)
const timestamp =
message.timestamp !== undefined &&
Number.isFinite(Number(message.timestamp))
@@ -160,6 +171,7 @@ export function handlePicoMessage(
content,
kind,
toolCalls,
...(modelName ? { modelName } : {}),
...(attachments ? { attachments } : {}),
}
})
@@ -178,6 +190,7 @@ export function handlePicoMessage(
content,
kind,
toolCalls,
...(modelName ? { modelName } : {}),
...(attachments ? { attachments } : {}),
timestamp,
},