-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/janhq/cortex into readme
- Loading branch information
Showing
12 changed files
with
116 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 15 additions & 3 deletions
18
cortex-js/src/infrastructure/commanders/models/model-list.command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
import { CommandRunner, SubCommand } from 'nest-commander'; | ||
import { CommandRunner, SubCommand, Option } from 'nest-commander'; | ||
import { ModelsCliUsecases } from '../usecases/models.cli.usecases'; | ||
|
||
interface ModelListOptions { | ||
format: 'table' | 'json'; | ||
} | ||
@SubCommand({ name: 'list', description: 'List all models locally.' }) | ||
export class ModelListCommand extends CommandRunner { | ||
constructor(private readonly modelsCliUsecases: ModelsCliUsecases) { | ||
super(); | ||
} | ||
|
||
async run(): Promise<void> { | ||
async run(_input: string[], option: ModelListOptions): Promise<void> { | ||
const models = await this.modelsCliUsecases.listAllModels(); | ||
console.log(models); | ||
option.format === 'table' ? console.table(models) : console.log(models); | ||
} | ||
|
||
@Option({ | ||
flags: '-f, --format <format>', | ||
defaultValue: 'json', | ||
description: 'Print models list in table or json format', | ||
}) | ||
parseModelId(value: string) { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
cortex-js/src/infrastructure/controllers/cortex.controller.spec.ts
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
cortex-js/src/infrastructure/controllers/cortex.controller.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { CortexUsecases } from './cortex.usecases'; | ||
import { CortexController } from '@/infrastructure/controllers/cortex.controller'; | ||
import { HttpModule } from '@nestjs/axios'; | ||
import { FileManagerModule } from '@/file-manager/file-manager.module'; | ||
|
||
@Module({ | ||
imports: [HttpModule, FileManagerModule], | ||
providers: [CortexUsecases], | ||
controllers: [CortexController], | ||
exports: [CortexUsecases], | ||
}) | ||
export class CortexModule {} |