Add assembly ai conversion
This commit is contained in:
@@ -31,6 +31,7 @@ import { EmailModule } from './email/email.module';
|
|||||||
import { ContactModule } from './contact/contact.module';
|
import { ContactModule } from './contact/contact.module';
|
||||||
import { HoardingModule } from './hoarding/hoarding.module';
|
import { HoardingModule } from './hoarding/hoarding.module';
|
||||||
import { NamesModule } from './names/names.module';
|
import { NamesModule } from './names/names.module';
|
||||||
|
import { AssemblyAiModule } from './assembly-ai/assembly-ai.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -108,6 +109,7 @@ import { NamesModule } from './names/names.module';
|
|||||||
ContactModule,
|
ContactModule,
|
||||||
HoardingModule,
|
HoardingModule,
|
||||||
NamesModule,
|
NamesModule,
|
||||||
|
AssemblyAiModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [
|
providers: [
|
||||||
|
37
src/assembly-ai/assembly-ai.controller.ts
Normal file
37
src/assembly-ai/assembly-ai.controller.ts
Normal 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}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
7
src/assembly-ai/assembly-ai.module.ts
Normal file
7
src/assembly-ai/assembly-ai.module.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Module } from '@nestjs/common';
|
||||||
|
import { AssemblyAiController } from './assembly-ai.controller';
|
||||||
|
|
||||||
|
@Module({
|
||||||
|
controllers: [AssemblyAiController]
|
||||||
|
})
|
||||||
|
export class AssemblyAiModule {}
|
@@ -22,7 +22,7 @@ export class HoardingService {
|
|||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await this.hoardUserChessStats('archyotype');
|
await this.hoardUserChessStats('archy_type');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,11 @@ export class HoardingService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error(e);
|
this.logger.error(e);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
await this.hoardLichessStats('archy_type');
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async hoardLichessStats(user: string) {
|
async hoardLichessStats(user: string) {
|
||||||
|
Reference in New Issue
Block a user