MCPcopy Create free account
hub / github.com/TanStack/ai / textPreviewFromResult

Function textPreviewFromResult

packages/ai-client/src/devtools.ts:212–232  ·  view source on GitHub ↗
(result: unknown)

Source from the content-addressed store, hash-verified

210}
211
212function 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
234function videoJobFromStatus(
235 record: UnknownRecord | undefined,

Callers 1

Calls 2

asRecordFunction · 0.70
stringFieldFunction · 0.70

Tested by

no test coverage detected