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

Function toFileRecord

apps/sim/lib/copilot/tools/handlers/materialize-file.ts:20–36  ·  view source on GitHub ↗
(row: typeof workspaceFiles.$inferSelect)

Source from the content-addressed store, hash-verified

18const logger = createLogger('MaterializeFile')
19
20function toFileRecord(row: typeof workspaceFiles.$inferSelect) {
21 const pathPrefix = getServePathPrefix()
22 return {
23 id: row.id,
24 workspaceId: row.workspaceId || '',
25 name: row.displayName ?? row.originalName,
26 key: row.key,
27 path: `${pathPrefix}${encodeURIComponent(row.key)}?context=mothership`,
28 size: row.size,
29 type: row.contentType,
30 uploadedBy: row.userId,
31 deletedAt: row.deletedAt,
32 uploadedAt: row.uploadedAt,
33 updatedAt: row.updatedAt,
34 storageContext: 'mothership' as const,
35 }
36}
37
38async function executeSave(fileName: string, chatId: string): Promise<ToolCallResult> {
39 const row = await findMothershipUploadRowByChatAndName(chatId, fileName)

Callers 1

executeImportFunction · 0.85

Calls 1

getServePathPrefixFunction · 0.90

Tested by

no test coverage detected