(result: unknown)
| 210 | } |
| 211 | |
| 212 | function textPreviewFromResult(result: unknown): AIDevtoolsGenerationPreview { |
| 213 | const record = asRecord(result) |
| 214 | const text = |
| 215 | stringField(record, 'text') ?? |
| 216 | stringField(record, 'summary') ?? |
| 217 | stringField(record, 'content') ?? |
| 218 | (typeof result === 'string' ? result : undefined) |
| 219 | |
| 220 | if (text !== undefined) { |
| 221 | return { kind: 'text', text } |
| 222 | } |
| 223 | |
| 224 | if (result === null || result === undefined) { |
| 225 | return { kind: 'empty' } |
| 226 | } |
| 227 | |
| 228 | return { |
| 229 | kind: 'structured', |
| 230 | value: result, |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | function videoJobFromStatus( |
| 235 | record: UnknownRecord | undefined, |
no test coverage detected