MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / buildReplyToMessageSnapshot

Function buildReplyToMessageSnapshot

packages/kilo-chat/src/utils.ts:146–165  ·  view source on GitHub ↗
(
  messageId: string,
  parent: ReplySnapshotParent | null | undefined
)

Source from the content-addressed store, hash-verified

144
145/**
146 * Short, human-readable single-line preview of a message's content blocks.
147 * Falls back to attachment filenames (or a mime-typed descriptor) when no
148 * text is present, so attachment-only messages don't render as empty strings
149 * in reply previews, conversation list previews, etc.
150 */
151export function contentBlocksPreviewText(content: Array<PreviewBlock>): string {
152 const text = contentBlocksToText(content).trim();
153 if (text) return text;
154 const labels = contentBlocksAttachmentPreviewLabels(content);
155 if (labels.length === 0) return '';
156 return labels
157 .map(label => {
158 switch (label.kind) {
159 case 'filename':
160 return label.filename;
161 case 'image':
162 return 'Image';
163 case 'attachment':
164 return 'Attachment';
165 }
166 })
167 .join(', ');
168}

Callers 3

utils.test.tsFile · 0.90
buildReplySnapshotFunction · 0.90
getReplyToSnapshotFunction · 0.90

Calls 1

contentBlocksPreviewTextFunction · 0.85

Tested by

no test coverage detected