feat: add telegram bot
This commit is contained in:
@@ -228,3 +228,21 @@ export async function extractRecipe(content: string) {
|
||||
|
||||
return recipeResponseSchema.parse(completion.choices[0].message.parsed);
|
||||
}
|
||||
|
||||
export async function transcribe(
|
||||
mp3Data: Uint8Array,
|
||||
): Promise<string | undefined> {
|
||||
if (!openAI) return;
|
||||
|
||||
const file = new File([mp3Data], "audio.mp3", {
|
||||
type: "audio/mpeg",
|
||||
});
|
||||
|
||||
const result = await openAI.audio.transcriptions.create({
|
||||
file,
|
||||
model: "whisper-1",
|
||||
response_format: "text",
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user