Add assembly ai conversion

This commit is contained in:
2025-04-24 13:17:41 -06:00
parent 76f093eeda
commit 149668a673
4 changed files with 52 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
import { Body, Controller, Post } from '@nestjs/common';
import { ApiResponse } from '@nestjs/swagger';
interface Utterance {
speaker: string;
text: string;
start: number;
end: number;
confidence: number;
words: Array<{
start: number;
end: number;
text: string;
confidence: number;
speaker: string;
}>;
}
@Controller('assembly-ai')
export class AssemblyAiController {
@Post('utterance-to-script')
@ApiResponse({
status: 200,
description: 'Converts utterances to a script format',
type: String,
})
async utteranceToScript(
@Body() body: { utterances: Utterance[] } | Utterance[],
) {
const utterances = Array.isArray(body) ? body : body.utterances;
return utterances.map(
(utterance) => `
${utterance.speaker}:
${utterance.text}`,
);
}
}