chore: harden rpc assistant streaming types
parent
6b10f4241d
commit
27a545f79d
File diff suppressed because it is too large
Load Diff
|
|
@ -535,11 +535,12 @@ export async function runCommandReply(
|
||||||
let lastStreamedAssistant: string | undefined;
|
let lastStreamedAssistant: string | undefined;
|
||||||
const streamAssistantFinal = (msg?: {
|
const streamAssistantFinal = (msg?: {
|
||||||
role?: string;
|
role?: string;
|
||||||
content?: unknown;
|
content?: unknown | unknown[];
|
||||||
}) => {
|
}) => {
|
||||||
if (!onPartialReply || msg?.role !== "assistant") return;
|
if (!onPartialReply || msg?.role !== "assistant") return;
|
||||||
const textBlocks = Array.isArray(msg.content)
|
const content = msg.content;
|
||||||
? (msg.content as Array<{ type?: string; text?: string }>)
|
const textBlocks = Array.isArray(content)
|
||||||
|
? (content as Array<{ type?: string; text?: string }>)
|
||||||
.filter((c) => c?.type === "text" && typeof c.text === "string")
|
.filter((c) => c?.type === "text" && typeof c.text === "string")
|
||||||
.map((c) => (c.text ?? "").trim())
|
.map((c) => (c.text ?? "").trim())
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue