UNPKG

@abhagsain/ai-cli

Version:

Get answers for CLI commands from GPT3 right from your terminal

37 lines (36 loc) 1.61 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const core_1 = require("@oclif/core"); const chalk_1 = tslib_1.__importDefault(require("chalk")); const inquirer = tslib_1.__importStar(require("inquirer")); const index_1 = require("../helpers/index"); class Model extends core_1.Command { async run() { const currentModel = (0, index_1.getCurrentModel)(this.config.configDir); const prompt = await inquirer.prompt([ { name: "modelName", message: "Please select a model", type: "list", choices: index_1.models.map((model) => { const name = model.name === currentModel.name ? model.name + chalk_1.default.yellowBright(" (current)") : model.name; return { name: model.isLimitedBeta ? name + chalk_1.default.dim(" (limited beta)") : name, value: model, }; }), }, ]); const { modelName } = prompt; (0, index_1.saveModelPreference)(this.config.configDir, modelName); this.log(`\n✅ Model preference saved. You can change it anytime again with ${chalk_1.default.bold.yellow("ai model")}`); } } exports.default = Model; Model.description = `Change model preference (default: ${index_1.defaultModel.name})`; Model.examples = ["<%= config.bin %> <%= command.id %> (Follow the prompt)"];