diff --git a/src/gemini/gemini.controller.spec.ts b/src/gemini/gemini.controller.spec.ts deleted file mode 100644 index 6823f1a..0000000 --- a/src/gemini/gemini.controller.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { GeminiController } from './gemini.controller'; - -describe('GeminiController', () => { - let controller: GeminiController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [GeminiController], - }).compile(); - - controller = module.get(GeminiController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/src/gemini/gemini.module.ts b/src/gemini/gemini.module.ts deleted file mode 100644 index 57f4663..0000000 --- a/src/gemini/gemini.module.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { Module } from '@nestjs/common'; - -@Module({}) -export class GeminiModule {} diff --git a/src/gemini/gemini.service.spec.ts b/src/gemini/gemini.service.spec.ts deleted file mode 100644 index 92f3163..0000000 --- a/src/gemini/gemini.service.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { GeminiService } from './gemini.service'; - -describe('GeminiService', () => { - let service: GeminiService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [GeminiService], - }).compile(); - - service = module.get(GeminiService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); diff --git a/src/gemini/gemini.service.ts b/src/gemini/gemini.service.ts deleted file mode 100644 index f2ad2ff..0000000 --- a/src/gemini/gemini.service.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@nestjs/common'; - -import OpenAI from 'openai'; - -@Injectable() -export class GeminiService { - private readonly model = 'gemini-2.0-flash'; - private readonly systemPrompt = - 'Você é um assistente de IA que responde em portugues.'; - - private readonly gemini = new OpenAI({ - apiKey: process.env.GEMINI_API_KEY, - baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai/', - }); - - public async generate({ - model = this.model, - message, - systemPrompt = this.systemPrompt, - }: { - model?: string; - message: string; - systemPrompt?: string; - }) { - try { - const response = await this.gemini.chat.completions.create({ - model, - messages: [ - { - role: 'system', - content: systemPrompt, - }, - { - role: 'user', - content: message, - }, - ], - }); - - return response; - } catch (error) { - throw new Error(error as string); - } - } -} diff --git a/src/modules/ollama/dto/chat.dto.ts b/src/modules/ollama/dto/chat.dto.ts deleted file mode 100644 index 6212385..0000000 --- a/src/modules/ollama/dto/chat.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { IsNotEmpty, IsString } from 'class-validator'; - -export class ChatDto { - @IsString() - @IsNotEmpty() - message: string; - - @IsString() - model: string; -} diff --git a/src/modules/ollama/ollama.controller.spec.ts b/src/modules/ollama/ollama.controller.spec.ts deleted file mode 100644 index b0c2ecc..0000000 --- a/src/modules/ollama/ollama.controller.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OllamaController } from './ollama.controller'; - -describe('OllamaController', () => { - let controller: OllamaController; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [OllamaController], - }).compile(); - - controller = module.get(OllamaController); - }); - - it('should be defined', () => { - expect(controller).toBeDefined(); - }); -}); diff --git a/src/modules/ollama/ollama.module.ts b/src/modules/ollama/ollama.module.ts deleted file mode 100644 index 2680197..0000000 --- a/src/modules/ollama/ollama.module.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Module } from '@nestjs/common'; -import { OllamaService } from './ollama.service'; - -@Module({ - providers: [OllamaService], -}) -export class OllamaModule {} diff --git a/src/modules/ollama/ollama.service.spec.ts b/src/modules/ollama/ollama.service.spec.ts deleted file mode 100644 index e8b0746..0000000 --- a/src/modules/ollama/ollama.service.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Test, TestingModule } from '@nestjs/testing'; -import { OllamaService } from './ollama.service'; - -describe('OllamaService', () => { - let service: OllamaService; - - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [OllamaService], - }).compile(); - - service = module.get(OllamaService); - }); - - it('should be defined', () => { - expect(service).toBeDefined(); - }); -}); diff --git a/src/modules/ollama/ollama.service.ts b/src/modules/ollama/ollama.service.ts deleted file mode 100644 index 48e6e8d..0000000 --- a/src/modules/ollama/ollama.service.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { Ollama } from 'ollama'; -import { Injectable } from '@nestjs/common'; -import type { ListResponse, ModelResponse } from 'ollama'; - -@Injectable() -export class OllamaService { - private readonly ollama: Ollama; - - constructor() { - this.ollama = new Ollama({ host: 'http://154.12.229.181:11434' }); - } - - public async getModels({ onlyChats }: { onlyChats: boolean }) { - try { - const modelsData = await this.ollama.list(); - - if (onlyChats) { - return this.getChatModels(modelsData); - } - - return modelsData.models; - } catch (error) { - throw new Error(error as string); - } - } - - public getChatModels(modelsData: ListResponse): ModelResponse[] { - const excludeFamilies = ['nomic-bert', 'embed', 'embedding']; - - return modelsData.models.filter((model) => { - const families = model.details?.families || []; - - return !families.some((f) => excludeFamilies.includes(f.toLowerCase())); - }); - } - - public async generateChat({ - model, - message, - }: { - model: string; - message: string; - }) { - try { - const response = await this.ollama.chat({ - model, - messages: [{ role: 'user', content: message }], - }); - - return response.message.content; - } catch (error) { - throw new Error(error as string); - } - } -} diff --git a/src/modules/videos/dto/create-video-dto.ts b/src/modules/videos/dto/create-video-dto.ts index 621bd2e..27819f3 100644 --- a/src/modules/videos/dto/create-video-dto.ts +++ b/src/modules/videos/dto/create-video-dto.ts @@ -60,6 +60,11 @@ export class CreateVideoDto { @MaxLength(244) description?: string; + @IsOptional() + @IsUrl() + @MaxLength(244) + transcriptionUrl?: string; + @IsOptional() @IsNumber( { allowNaN: false, allowInfinity: false },