feat(audio): add native audio support to type system and model clients
- Add AudioSource interface and 'audio' variant to MessageContentPart union - Update buildUserMessage() to create audio content parts from attachments - Add attachmentToAudioSource(), hasAudio(), stripAudioParts() helpers - Gemini: native audio via inlineData (same format as images) - OpenAI/GitHub: native audio via input_audio content parts - Anthropic/Bedrock: graceful fallback to transcript text - Update getMessageTextWithTools() to handle audio blocks for local models
This commit is contained in:
@@ -41,6 +41,13 @@ function toAnthropicContent(content: string | MessageContentPart[]): string | un
|
||||
},
|
||||
};
|
||||
}
|
||||
// Audio — Anthropic doesn't support native audio input; use transcript fallback
|
||||
if (part.type === 'audio') {
|
||||
if (part.source.transcript) {
|
||||
return { type: 'text', text: `[Voice message]: ${part.source.transcript}` };
|
||||
}
|
||||
return { type: 'text', text: '[Audio message received but no transcript available]' };
|
||||
}
|
||||
return part;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user