MCPcopy Index your code
hub / github.com/TanStack/ai / createAIDevtoolsGenerationPreview

Function createAIDevtoolsGenerationPreview

packages/ai-client/src/devtools.ts:120–147  ·  view source on GitHub ↗
(
  input: AIDevtoolsGenerationPreviewInput,
)

Source from the content-addressed store, hash-verified

118}
119
120export function createAIDevtoolsGenerationPreview(
121 input: AIDevtoolsGenerationPreviewInput,
122): AIDevtoolsGenerationPreview {
123 if (input.outputKind === 'image') {
124 return imagePreviewFromResult(input.result)
125 }
126
127 if (input.outputKind === 'audio') {
128 return audioPreviewFromResult(input.result)
129 }
130
131 if (input.outputKind === 'video') {
132 return videoPreviewFromResult(input.result, input.videoStatus)
133 }
134
135 if (input.outputKind === 'text') {
136 return textPreviewFromResult(input.result)
137 }
138
139 if (input.result === null || input.result === undefined) {
140 return { kind: 'empty' }
141 }
142
143 return {
144 kind: 'structured',
145 value: input.result,
146 }
147}
148
149type UnknownRecord = { [key: string]: unknown }
150

Callers 3

createPreviewMethod · 0.85
createVideoPreviewMethod · 0.85

Calls 4

imagePreviewFromResultFunction · 0.85
audioPreviewFromResultFunction · 0.85
videoPreviewFromResultFunction · 0.85
textPreviewFromResultFunction · 0.85

Tested by

no test coverage detected