38
*/
39
export function formatChatTranscript(turns: readonly Turn[]): string {
41
>
for (const turn of turns) {
42
>
const userText = turn.message?.text?.trim();
43
>
if (userText) {
44
>
blocks.push(`User: ${userText}`);
45
>
}
46
>
const assistantText = turn.responseParts
47
>
.map(part => (part.kind === ResponsePartKind.Markdown ? part.content : ''))
48
>
.join('')
49
>
.trim();
50
>
if (assistantText) {
51
>
blocks.push(`Assistant: ${assistantText}`);
52
>
}
53
>
}
54
>
return blocks.join('\n\n');
55
>
}
56
57
/**