MCPcopy Index your code
hub / github.com/codeaashu/claude-code / buildImageContentBlocks

Function buildImageContentBlocks

src/utils/attachments.ts:1103–1129  ·  view source on GitHub ↗
(
  pastedContents: Record<number, PastedContent> | undefined,
)

Source from the content-addressed store, hash-verified

1101}
1102
1103async function buildImageContentBlocks(
1104 pastedContents: Record<number, PastedContent> | undefined,
1105): Promise<ImageBlockParam[]> {
1106 if (!pastedContents) {
1107 return []
1108 }
1109 const imageContents = Object.values(pastedContents).filter(isValidImagePaste)
1110 if (imageContents.length === 0) {
1111 return []
1112 }
1113 const results = await Promise.all(
1114 imageContents.map(async img => {
1115 const imageBlock: ImageBlockParam = {
1116 type: 'image',
1117 source: {
1118 type: 'base64',
1119 media_type: (img.mediaType ||
1120 'image/png') as Base64ImageSource['media_type'],
1121 data: img.content,
1122 },
1123 }
1124 const resized = await maybeResizeAndDownsampleImageBlock(imageBlock)
1125 return resized.block
1126 }),
1127 )
1128 return results
1129}
1130
1131function getPlanModeAttachmentTurnCount(messages: Message[]): {
1132 turnCount: number

Callers 1

Calls 2

valuesMethod · 0.80

Tested by

no test coverage detected