Remove gemini and ollama

This commit is contained in:
LeoMortari
2025-10-03 18:46:22 -03:00
parent 558a625f11
commit 43be1244c7
10 changed files with 5 additions and 193 deletions

View File

@@ -1,10 +0,0 @@
import { IsNotEmpty, IsString } from 'class-validator';
export class ChatDto {
@IsString()
@IsNotEmpty()
message: string;
@IsString()
model: string;
}

View File

@@ -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>(OllamaController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@@ -1,7 +0,0 @@
import { Module } from '@nestjs/common';
import { OllamaService } from './ollama.service';
@Module({
providers: [OllamaService],
})
export class OllamaModule {}

View File

@@ -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>(OllamaService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@@ -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);
}
}
}

View File

@@ -60,6 +60,11 @@ export class CreateVideoDto {
@MaxLength(244)
description?: string;
@IsOptional()
@IsUrl()
@MaxLength(244)
transcriptionUrl?: string;
@IsOptional()
@IsNumber(
{ allowNaN: false, allowInfinity: false },