This commit is contained in:
parent
2fd19e9bae
commit
350af31eec
@ -30,6 +30,11 @@ export class AdminAccessController {
|
||||
return this.adminAccessService.listAiContents();
|
||||
}
|
||||
|
||||
@Get('ai-contents/:id/file')
|
||||
getAiContentFile(@Param('id') id: string) {
|
||||
return this.adminAccessService.getAiContentFile(Number(id));
|
||||
}
|
||||
|
||||
@Post('ai-contents')
|
||||
createAiContent(@Body() body: {
|
||||
title?: string;
|
||||
|
||||
@ -320,6 +320,23 @@ export class AdminAccessService {
|
||||
return result.rows;
|
||||
}
|
||||
|
||||
async getAiContentFile(id: number) {
|
||||
const result = await this.database.query(
|
||||
`
|
||||
SELECT id, title, filename, mimetype, content_base64
|
||||
FROM ai_knowledge_contents
|
||||
WHERE id = $1
|
||||
`,
|
||||
[id],
|
||||
);
|
||||
|
||||
if (!result.rows[0]) {
|
||||
throw new Error('Conteudo de IA nao encontrado');
|
||||
}
|
||||
|
||||
return result.rows[0];
|
||||
}
|
||||
|
||||
async createAiContent(input: AiContentInput) {
|
||||
const title = String(input.title || '').trim();
|
||||
if (!title) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user