Skip to content

Commit

Permalink
chore: drop model entity
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Jun 10, 2024
1 parent 09b920e commit 044f0c1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 84 deletions.
6 changes: 4 additions & 2 deletions cortex-js/src/infrastructure/controllers/models.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { ModelsUsecases } from '@/usecases/models/models.usecases';
import { CreateModelDto } from '@/infrastructure/dtos/models/create-model.dto';
import { UpdateModelDto } from '@/infrastructure/dtos/models/update-model.dto';
import { ModelDto } from '@/infrastructure/dtos/models/model-successfully-created.dto';
import { ModelDto } from '@/infrastructure/dtos/models/model.dto';
import { ListModelsResponseDto } from '@/infrastructure/dtos/models/list-model-response.dto';
import { DeleteModelResponseDto } from '@/infrastructure/dtos/models/delete-model.dto';
import { DownloadModelResponseDto } from '@/infrastructure/dtos/models/download-model.dto';
Expand Down Expand Up @@ -120,7 +120,9 @@ export class ModelsController {
})
@Get()
findAll() {
return this.modelsUsecases.findAll();
return this.modelsUsecases
.findAll()
.then((data) => data.map((e) => ({ id: e.model, ...e })));
}

@HttpCode(200)
Expand Down
9 changes: 1 addition & 8 deletions cortex-js/src/infrastructure/database/database.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Module } from '@nestjs/common';
import { threadProviders } from './providers/thread.providers';
import { sqliteDatabaseProviders } from './sqlite-database.providers';
import { modelProviders } from './providers/model.providers';
import { assistantProviders } from './providers/assistant.providers';
import { messageProviders } from './providers/message.providers';
import { FileManagerModule } from '@/file-manager/file-manager.module';
Expand All @@ -11,15 +10,9 @@ import { FileManagerModule } from '@/file-manager/file-manager.module';
providers: [
...sqliteDatabaseProviders,
...threadProviders,
...modelProviders,
...assistantProviders,
...messageProviders,
],
exports: [
...threadProviders,
...modelProviders,
...assistantProviders,
...messageProviders,
],
exports: [...threadProviders, ...assistantProviders, ...messageProviders],
})
export class DatabaseModule {}
11 changes: 0 additions & 11 deletions cortex-js/src/infrastructure/database/providers/model.providers.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { ModelDto } from './model-successfully-created.dto'; // Import the ModelDto class
import { ModelDto } from './model.dto'; // Import the ModelDto class

export class ListModelsResponseDto {
@ApiProperty({ example: 'list', enum: ['list'] })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { ApiProperty } from '@nestjs/swagger';
import { IsArray, IsBoolean, IsNumber, IsOptional } from 'class-validator';

export class ModelDto implements Partial<Model> {
@ApiProperty({
example: 'llama3',
description:
'The model identifier, which can be referenced in the API endpoints.',
})
@IsOptional()
id: string;

// Prompt Settings
@ApiProperty({
example: 'system\n{system_message}\nuser\n{prompt}\nassistant',
Expand Down
60 changes: 0 additions & 60 deletions cortex-js/src/infrastructure/entities/model.entity.ts

This file was deleted.

3 changes: 1 addition & 2 deletions cortex-js/src/usecases/models/models.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { firstValueFrom } from 'rxjs';
import { FileManagerService } from '@/file-manager/file-manager.service';
import { AxiosError } from 'axios';
import { ModelRepository } from '@/domain/repositories/model.interface';
import { ModelDto } from '@/infrastructure/dtos/models/model-successfully-created.dto';
import { ModelParameterParser } from '@/infrastructure/commanders/utils/model-parameter.parser';

@Injectable()
Expand Down Expand Up @@ -81,7 +80,7 @@ export class ModelsUsecases {

async startModel(
modelId: string,
settings?: ModelDto,
settings?: ModelSettingParams,
): Promise<StartModelSuccessDto> {
const model = await this.getModelOrThrow(modelId);
const extensions = (await this.extensionRepository.findAll()) ?? [];
Expand Down

0 comments on commit 044f0c1

Please sign in to comment.