MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / getUserMessage

Function getUserMessage

cli/src/utils/message-history.ts:12–34  ·  view source on GitHub ↗
(
  message: string | ContentBlock[],
  attachments?: ImageAttachment[],
  textAttachments?: TextAttachment[],
  fileAttachments?: FileAttachment[],
)

Source from the content-addressed store, hash-verified

10const MAX_HISTORY_SIZE = 1000
11
12export function getUserMessage(
13 message: string | ContentBlock[],
14 attachments?: ImageAttachment[],
15 textAttachments?: TextAttachment[],
16 fileAttachments?: FileAttachment[],
17): ChatMessage {
18 return {
19 id: `user-${Date.now()}`,
20 variant: 'user',
21 ...(typeof message === 'string'
22 ? {
23 content: message,
24 }
25 : {
26 content: '',
27 blocks: message,
28 }),
29 timestamp: formatTimestamp(),
30 ...(attachments && attachments.length > 0 ? { attachments } : {}),
31 ...(textAttachments && textAttachments.length > 0 ? { textAttachments } : {}),
32 ...(fileAttachments && fileAttachments.length > 0 ? { fileAttachments } : {}),
33 }
34}
35
36export function getSystemMessage(
37 content: string | ContentBlock[],

Callers 4

createSkillCommandFunction · 0.90
routeUserPromptFunction · 0.90
prepareUserMessageFunction · 0.90

Calls 1

formatTimestampFunction · 0.90

Tested by

no test coverage detected