25 lines
498 B
TypeScript
25 lines
498 B
TypeScript
export const LIVE_OK_PROMPT = "Reply with the word ok.";
|
|
|
|
export function createSingleUserPromptMessage(content = LIVE_OK_PROMPT) {
|
|
return [
|
|
{
|
|
role: "user" as const,
|
|
content,
|
|
timestamp: Date.now(),
|
|
},
|
|
];
|
|
}
|
|
|
|
export function extractNonEmptyAssistantText(
|
|
content: Array<{
|
|
type?: string;
|
|
text?: string;
|
|
}>,
|
|
) {
|
|
return content
|
|
.filter((block) => block.type === "text")
|
|
.map((block) => block.text?.trim() ?? "")
|
|
.filter(Boolean)
|
|
.join(" ");
|
|
}
|