Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit ab36451

Browse files
committed
refactor: questions
1 parent 7201807 commit ab36451

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

cortex-js/src/command.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ExtensionModule } from './infrastructure/repositories/extensions/extens
99
import { ChatModule } from './usecases/chat/chat.module';
1010
import { InitCommand } from './infrastructure/commanders/init.command';
1111
import { HttpModule } from '@nestjs/axios';
12-
import { CreateInitQuestions } from './infrastructure/commanders/inquirer/init.questions';
12+
import { InitRunModeQuestions } from './infrastructure/commanders/questions/init.questions';
1313
import { ModelListCommand } from './infrastructure/commanders/models/model-list.command';
1414
import { ModelPullCommand } from './infrastructure/commanders/models/model-pull.command';
1515
import { CortexCommand } from './infrastructure/commanders/cortex-command.commander';
@@ -19,7 +19,7 @@ import { ModelStopCommand } from './infrastructure/commanders/models/model-stop.
1919
import { ModelGetCommand } from './infrastructure/commanders/models/model-get.command';
2020
import { ModelRemoveCommand } from './infrastructure/commanders/models/model-remove.command';
2121
import { RunCommand } from './infrastructure/commanders/shortcuts/run.command';
22-
import { InitCudaQuestions } from './infrastructure/commanders/inquirer/cuda.questions';
22+
import { InitCudaQuestions } from './infrastructure/commanders/questions/cuda.questions';
2323
import { CliUsecasesModule } from './infrastructure/commanders/usecases/cli.usecases.module';
2424

2525
@Module({
@@ -45,7 +45,7 @@ import { CliUsecasesModule } from './infrastructure/commanders/usecases/cli.usec
4545
InitCommand,
4646

4747
// Questions
48-
CreateInitQuestions,
48+
InitRunModeQuestions,
4949
InitCudaQuestions,
5050

5151
// Model commands

cortex-js/src/infrastructure/commanders/init.command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class InitCommand extends CommandRunner {
1919
}
2020

2121
async run(input: string[], options?: InitOptions): Promise<void> {
22-
options = await this.inquirerService.ask('create-init-questions', options);
22+
options = await this.inquirerService.ask('init-run-mode-questions', options);
2323

2424
if (options.runMode === 'GPU' && !(await this.initUsecases.cudaVersion())) {
2525
options = await this.inquirerService.ask('init-cuda-questions', options);

cortex-js/src/infrastructure/commanders/inquirer/cuda.questions.ts renamed to cortex-js/src/infrastructure/commanders/questions/cuda.questions.ts

File renamed without changes.

cortex-js/src/infrastructure/commanders/inquirer/init.questions.ts renamed to cortex-js/src/infrastructure/commanders/questions/hugging-face.questions.ts

File renamed without changes.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Question, QuestionSet } from 'nest-commander';
2+
import { platform } from 'node:process';
3+
4+
@QuestionSet({ name: 'init-run-mode-questions' })
5+
export class InitRunModeQuestions {
6+
@Question({
7+
type: 'list',
8+
message: 'Select run mode',
9+
name: 'runMode',
10+
default: 'CPU',
11+
choices: ['CPU', 'GPU'],
12+
when: () => platform !== 'darwin',
13+
})
14+
parseRunMode(val: string) {
15+
return val;
16+
}
17+
18+
@Question({
19+
type: 'list',
20+
message: 'Select GPU type',
21+
name: 'gpuType',
22+
default: 'Nvidia',
23+
choices: ['Nvidia', 'Others (Vulkan)'],
24+
when: (answers: any) => answers.runMode === 'GPU',
25+
})
26+
parseGPUType(val: string) {
27+
return val;
28+
}
29+
30+
@Question({
31+
type: 'list',
32+
message: 'Select CPU instructions set',
33+
name: 'instructions',
34+
choices: ['AVX2', 'AVX', 'AVX512'],
35+
when: () => platform !== 'darwin',
36+
})
37+
parseContent(val: string) {
38+
return val;
39+
}
40+
}

0 commit comments

Comments
 (0)