MCPcopy
hub / github.com/simstudioai/sim / readChatUpload

Function readChatUpload

apps/sim/lib/copilot/tools/handlers/upload-file-reader.ts:147–163  ·  view source on GitHub ↗
(
  filename: string,
  chatId: string
)

Source from the content-addressed store, hash-verified

145 * matches when the model passes a visually equivalent path.
146 */
147export async function readChatUpload(
148 filename: string,
149 chatId: string
150): Promise<FileReadResult | null> {
151 try {
152 const row = await findMothershipUploadRowByChatAndName(chatId, filename)
153 if (!row) return null
154 return readFileRecord(toWorkspaceFileRecord(row))
155 } catch (err) {
156 logger.warn('Failed to read chat upload', {
157 filename,
158 chatId,
159 error: toError(err).message,
160 })
161 return null
162 }
163}
164
165/**
166 * Grep the content of a single chat upload (`uploads/<name>`), mirroring

Callers 2

executeVfsReadFunction · 0.90

Calls 5

readFileRecordFunction · 0.90
toErrorFunction · 0.90
toWorkspaceFileRecordFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected