MCPcopy Index your code
hub / github.com/simstudioai/sim / buildPersistedUserMessage

Function buildPersistedUserMessage

apps/sim/lib/copilot/chat/persisted-message.ts:315–341  ·  view source on GitHub ↗
(params: UserMessageParams)

Source from the content-addressed store, hash-verified

313}
314
315export function buildPersistedUserMessage(params: UserMessageParams): PersistedMessage {
316 const message: PersistedMessage = {
317 id: params.id,
318 role: 'user',
319 content: params.content,
320 timestamp: new Date().toISOString(),
321 }
322
323 if (params.fileAttachments && params.fileAttachments.length > 0) {
324 message.fileAttachments = params.fileAttachments
325 }
326
327 if (params.contexts && params.contexts.length > 0) {
328 message.contexts = params.contexts.map((c) => ({
329 kind: c.kind,
330 label: c.label,
331 ...(c.workflowId ? { workflowId: c.workflowId } : {}),
332 ...(c.knowledgeId ? { knowledgeId: c.knowledgeId } : {}),
333 ...(c.tableId ? { tableId: c.tableId } : {}),
334 ...(c.fileId ? { fileId: c.fileId } : {}),
335 ...(c.folderId ? { folderId: c.folderId } : {}),
336 ...(c.chatId ? { chatId: c.chatId } : {}),
337 }))
338 }
339
340 return message
341}
342
343// ---------------------------------------------------------------------------
344// Read: raw JSONB → PersistedMessage

Callers 3

persistChatMessagesFunction · 0.90
persistUserMessageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected