Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { BaseCommand } from '../base.command';
import { downloadProgress } from '@/utils/download-progress';
import { CortexClient } from '../services/cortex.client';
import { DownloadType } from '@/domain/models/download.interface';
import ora from 'ora';

@SubCommand({
name: 'pull',
Expand Down Expand Up @@ -52,13 +53,16 @@ export class ModelPullCommand extends BaseCommand {
exit(1);
}

console.log('Downloading model...');
await this.cortex.models.download(modelId).catch((e: Error) => {
if (e instanceof ModelNotFoundException)
console.error('Model does not exist.');
else console.error(e.message ?? e);
exit(1);
});

ora().succeed('Model downloaded');

await downloadProgress(this.cortex, modelId);

const existingModel = await this.cortex.models.retrieve(modelId);
Expand Down
2 changes: 2 additions & 0 deletions cortex-js/src/infrastructure/commanders/run.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ export class RunCommand extends BaseCommand {
if (!(await this.cortex.models.retrieve(modelId))) {
checkingSpinner.succeed();

console.log('Downloading model...');
await this.cortex.models.download(modelId).catch((e: Error) => {
checkingSpinner.fail(e.message ?? e);
exit(1);
});
await downloadProgress(this.cortex, modelId);
}
ora().succeed('Model downloaded');

// Second check if model is available
const existingModel = await this.cortex.models.retrieve(modelId);
Expand Down