( input: AIDevtoolsGenerationPreviewInput, )
| 118 | } |
| 119 | |
| 120 | export 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 | |
| 149 | type UnknownRecord = { [key: string]: unknown } |
| 150 |
no test coverage detected