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

Function processChatFiles

apps/sim/lib/uploads/contexts/chat/chat-file-manager.ts:36–74  ·  view source on GitHub ↗
(
  files: ChatFile[],
  executionContext: ChatExecutionContext,
  requestId: string,
  userId?: string
)

Source from the content-addressed store, hash-verified

34 * @returns Array of UserFile objects with upload results
35 */
36export async function processChatFiles(
37 files: ChatFile[],
38 executionContext: ChatExecutionContext,
39 requestId: string,
40 userId?: string
41): Promise<UserFile[]> {
42 logger.info(
43 `Processing ${files.length} chat files for execution ${executionContext.executionId}`,
44 {
45 requestId,
46 executionContext,
47 }
48 )
49
50 const transformedFiles = files.map((file) => {
51 const inlineData = file.dataUrl || file.data
52
53 return {
54 type: inlineData ? ('file' as const) : ('url' as const),
55 data: inlineData || file.url || '',
56 name: file.name,
57 mime: file.type,
58 }
59 })
60
61 const userFiles = await processExecutionFiles(
62 transformedFiles,
63 executionContext,
64 requestId,
65 userId
66 )
67
68 logger.info(`Successfully processed ${userFiles.length} chat files`, {
69 requestId,
70 executionId: executionContext.executionId,
71 })
72
73 return userFiles
74}
75
76/**
77 * Upload a single chat file to temporary execution storage

Callers 1

uploadChatFileFunction · 0.85

Calls 2

processExecutionFilesFunction · 0.90
infoMethod · 0.80

Tested by

no test coverage detected