( content: string | null | undefined, files: UserFile[] | undefined, providerId: ProviderId | string )
| 525 | } |
| 526 | |
| 527 | export function buildGeminiMessageParts( |
| 528 | content: string | null | undefined, |
| 529 | files: UserFile[] | undefined, |
| 530 | providerId: ProviderId | string |
| 531 | ): Part[] { |
| 532 | const parts: Part[] = [] |
| 533 | if (content) { |
| 534 | parts.push({ text: content } satisfies Part) |
| 535 | } |
| 536 | |
| 537 | for (const attachment of prepareProviderAttachments(files, providerId)) { |
| 538 | parts.push( |
| 539 | attachment.providerFileUri |
| 540 | ? ({ |
| 541 | fileData: { |
| 542 | fileUri: attachment.providerFileUri, |
| 543 | mimeType: attachment.providerMimeType, |
| 544 | }, |
| 545 | } satisfies Part) |
| 546 | : ({ |
| 547 | inlineData: { |
| 548 | mimeType: attachment.providerMimeType, |
| 549 | data: attachment.base64 ?? '', |
| 550 | }, |
| 551 | } satisfies Part) |
| 552 | ) |
| 553 | } |
| 554 | |
| 555 | return parts |
| 556 | } |
| 557 | |
| 558 | export function buildOpenAICompatibleChatContent( |
| 559 | content: string | null | undefined, |
no test coverage detected