feat: complete mindspace conversation packages
This commit is contained in:
@@ -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 }] : [],
|
||||
|
||||
Reference in New Issue
Block a user