feat: complete mindspace conversation packages

This commit is contained in:
john
2026-07-02 23:46:05 +08:00
parent b084f6d23c
commit b258004dad
31 changed files with 1990 additions and 118 deletions
+8 -2
View File
@@ -119,7 +119,13 @@ export function normalizeUserMessageForApi(message: Message): Message {
export function buildUserMessage(
text: string,
options?: { agentText?: string; displayText?: string; imageUrls?: string[]; previewImageUrls?: string[] },
options?: {
id?: string;
agentText?: string;
displayText?: string;
imageUrls?: string[];
previewImageUrls?: string[];
},
): Message {
const displayText = stripImageUrlLines(options?.displayText ?? text);
const imageUrls = (options?.imageUrls ?? []).filter((value) => typeof value === 'string' && value.trim());
@@ -131,7 +137,7 @@ export function buildUserMessage(
const agentText = [baseAgentText.trim(), imageText].filter(Boolean).join('\n\n');
return {
id: crypto.randomUUID(),
id: options?.id ?? crypto.randomUUID(),
role: 'user',
created: Math.floor(Date.now() / 1000),
content: agentText ? [{ type: 'text', text: agentText }] : [],