MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / convertUserContentParts

Function convertUserContentParts

sdk/src/impl/chatgpt-backend-fetch.ts:70–86  ·  view source on GitHub ↗
(content: unknown)

Source from the content-addressed store, hash-verified

68}
69
70function convertUserContentParts(content: unknown): unknown {
71 if (typeof content === 'string') return content
72 if (!Array.isArray(content)) return String(content ?? '')
73 return content.map((part: Record<string, unknown>) => {
74 if (part.type === 'text') {
75 return { type: 'input_text', text: part.text }
76 }
77 if (part.type === 'image_url') {
78 const imageUrl = part.image_url as Record<string, unknown> | undefined
79 return {
80 type: 'input_image',
81 image_url: imageUrl?.url ?? imageUrl,
82 }
83 }
84 return part
85 })
86}
87
88function convertMessages(
89 messages: ChatCompletionsMessage[],

Callers 1

convertMessagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected