generated from fahricansecer/boilerplate-be
@@ -1,4 +1,4 @@
|
|||||||
import { Controller, Get, Post, Body, Res, HttpStatus, Param } from '@nestjs/common';
|
import { Controller, Get, Post, Body, Res, HttpStatus, Param, Delete } from '@nestjs/common';
|
||||||
import { Public } from '../../common/decorators';
|
import { Public } from '../../common/decorators';
|
||||||
import { VoiceboxService } from './voicebox.service';
|
import { VoiceboxService } from './voicebox.service';
|
||||||
import type { Response } from 'express';
|
import type { Response } from 'express';
|
||||||
@@ -54,4 +54,9 @@ export class VoiceboxController {
|
|||||||
async speak(@Body() body: { text: string; profile: string; personality?: boolean }) {
|
async speak(@Body() body: { text: string; profile: string; personality?: boolean }) {
|
||||||
return this.voiceboxService.speak(body.text, body.profile, body.personality);
|
return this.voiceboxService.speak(body.text, body.profile, body.personality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Delete('history/:id')
|
||||||
|
async deleteHistory(@Param('id') id: string) {
|
||||||
|
return this.voiceboxService.deleteHistory(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,4 +237,22 @@ export class VoiceboxService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Belirtilen ID'ye sahip VoiceBox geçmiş kaydını siler
|
||||||
|
*/
|
||||||
|
async deleteHistory(generationId: string) {
|
||||||
|
try {
|
||||||
|
const response: any = await lastValueFrom(
|
||||||
|
this.httpService.delete<any>(`${this.voiceboxUrl}/history/${generationId}`)
|
||||||
|
);
|
||||||
|
return response.data;
|
||||||
|
} catch (error: any) {
|
||||||
|
this.logger.error(`Error deleting VoiceBox history for ${generationId}`, error.message);
|
||||||
|
throw new HttpException(
|
||||||
|
'Geçmiş kaydı silinemedi',
|
||||||
|
HttpStatus.INTERNAL_SERVER_ERROR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user