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

Function fetchTranscript

apps/sim/connectors/grain/grain.ts:303–319  ·  view source on GitHub ↗

* Fetches the speaker-attributed transcript segments for a recording. * Returns null on 404, or an empty array when the recording has no transcript yet.

(
  accessToken: string,
  id: string
)

Source from the content-addressed store, hash-verified

301 * Returns null on 404, or an empty array when the recording has no transcript yet.
302 */
303async function fetchTranscript(
304 accessToken: string,
305 id: string
306): Promise<GrainTranscriptSegment[] | null> {
307 const response = await fetchWithRetry(`${GRAIN_API_BASE}/recordings/${id}/transcript`, {
308 method: 'GET',
309 headers: grainHeaders(accessToken),
310 })
311
312 if (!response.ok) {
313 if (response.status === 404) return null
314 throw new Error(`Failed to fetch Grain transcript: ${response.status}`)
315 }
316
317 const data = await response.json()
318 return Array.isArray(data) ? (data as GrainTranscriptSegment[]) : []
319}
320
321export const grainConnector: ConnectorConfig = {
322 ...grainConnectorMeta,

Callers 1

grain.tsFile · 0.85

Calls 2

fetchWithRetryFunction · 0.90
grainHeadersFunction · 0.85

Tested by

no test coverage detected