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

Function addPendingImageFromBase64

cli/src/utils/pending-attachments.ts:90–110  ·  view source on GitHub ↗
(
  base64Data: string,
  mediaType: string,
  filename: string,
  tempPath?: string,
)

Source from the content-addressed store, hash-verified

88 * Process an image from base64 data and add it to the pending images state.
89 */
90export async function addPendingImageFromBase64(
91 base64Data: string,
92 mediaType: string,
93 filename: string,
94 tempPath?: string,
95): Promise<void> {
96 // For base64 images (like clipboard), we already have the data
97 // Check size and add directly
98 const size = Math.round((base64Data.length * 3) / 4) // Approximate decoded size
99
100 useChatStore.getState().addPendingImage({
101 path: tempPath || `clipboard:${filename}`,
102 filename,
103 status: 'ready',
104 size,
105 processedImage: {
106 base64: base64Data,
107 mediaType,
108 },
109 })
110}
111
112const AUTO_REMOVE_ERROR_DELAY_MS = 3000
113

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected