viho 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -74,14 +74,39 @@ You'll be prompted to enter:
74
74
  viho model add
75
75
  ```
76
76
 
77
+ After adding a model, it will be available for use with `viho ask` and `viho chat` commands.
78
+
77
79
  #### `viho model list`
78
80
 
79
- List all configured models:
81
+ List all configured models with detailed information.
80
82
 
81
83
  ```bash
82
84
  viho model list
83
85
  ```
84
86
 
87
+ This command displays:
88
+
89
+ - Model name with a `(default)` tag for the default model
90
+ - Model ID
91
+ - Base URL
92
+ - Thinking mode setting
93
+
94
+ **Example output:**
95
+
96
+ ```
97
+ Configured models:
98
+
99
+ • deepseek (default)
100
+ Model ID: ep-20250822181529-2gg27
101
+ Base URL: https://ark.cn-beijing.volces.com/api/v3
102
+ Thinking: auto
103
+
104
+ • kimi
105
+ Model ID: kimi-k2-thinking
106
+ Base URL: https://api.moonshot.cn/v1
107
+ Thinking: enabled
108
+ ```
109
+
85
110
  #### `viho model remove`
86
111
 
87
112
  Remove a model configuration:
@@ -90,14 +115,18 @@ Remove a model configuration:
90
115
  viho model remove
91
116
  ```
92
117
 
118
+ You'll be prompted to enter the model name to remove. If the removed model was set as default, you'll need to set a new default model.
119
+
93
120
  #### `viho model default`
94
121
 
95
- Set a default model for chat sessions:
122
+ Set a default model for chat and ask sessions:
96
123
 
97
124
  ```bash
98
125
  viho model default
99
126
  ```
100
127
 
128
+ The default model will be used when you run `viho ask` or `viho chat` without specifying a model name.
129
+
101
130
  ### Ask
102
131
 
103
132
  #### `viho ask [modelName]`
package/bin/viho-model.js CHANGED
@@ -12,7 +12,7 @@ const actions = ['add', 'list', 'remove', 'default'];
12
12
  // model
13
13
  cli.cmd
14
14
  .command('model <action>')
15
- .description('Manage AI models')
15
+ .description('Manage AI model configurations (add, list, remove, default)')
16
16
  .action((action) => {
17
17
  if (!actions.includes(action)) {
18
18
  console.log(cli.colors.red('Invalid action. Use: add, list, remove, default'));
@@ -58,7 +58,7 @@ async function modelAdd() {
58
58
  type: 'list',
59
59
  name: 'modelThinking',
60
60
  message: 'Thinking mode:',
61
- choices: ['enabled', 'disabled', 'auto'],
61
+ choices: ['enabled', 'disabled'],
62
62
  },
63
63
  ];
64
64
  const answers = await cli.ask(questions);
@@ -76,12 +76,8 @@ async function modelAdd() {
76
76
  // set
77
77
  models.push(answers);
78
78
  await setModels(db, models);
79
- console.log(cli.colors.green('Model added'));
79
+ console.log(cli.colors.green('Model added successfully!'));
80
80
  console.log();
81
-
82
- // list
83
- const allModels = await getModels(db);
84
- console.log(allModels);
85
81
  } catch (e) {
86
82
  console.log(cli.colors.red('Error: Failed to add model'));
87
83
  console.log();
@@ -99,9 +95,31 @@ async function modelList() {
99
95
 
100
96
  // list
101
97
  const models = await getModels(db);
98
+ const defaultModel = await db.config('default');
99
+
102
100
  console.log(cli.colors.cyan('Configured models:'));
103
101
  console.log();
104
- console.log(models);
102
+
103
+ if (!models || models.length === 0) {
104
+ console.log(cli.colors.gray('No models configured. Use: viho model add'));
105
+ console.log();
106
+ return;
107
+ }
108
+
109
+ models.forEach((model) => {
110
+ const isDefault = model.modelName === defaultModel;
111
+ const defaultTag = isDefault ? cli.colors.green(' (default)') : '';
112
+ console.log(cli.colors.white(` • ${model.modelName}${defaultTag}`));
113
+ console.log(cli.colors.gray(` Model ID: ${model.modelID}`));
114
+ console.log(cli.colors.gray(` Base URL: ${model.baseURL}`));
115
+ console.log(cli.colors.gray(` Thinking: ${model.modelThinking}`));
116
+ console.log();
117
+ });
118
+
119
+ if (!defaultModel) {
120
+ console.log(cli.colors.yellow('No default model set. Use: viho model default'));
121
+ console.log();
122
+ }
105
123
  } catch (e) {
106
124
  console.log(cli.colors.red('Error: Failed to list models'));
107
125
  console.log();
@@ -149,12 +167,8 @@ async function modelRemove() {
149
167
  console.log();
150
168
  }
151
169
 
152
- console.log(cli.colors.green('Model removed'));
170
+ console.log(cli.colors.green('Model removed successfully!'));
153
171
  console.log();
154
-
155
- // list
156
- const allModels = await getModels(db);
157
- console.log(allModels);
158
172
  } catch (e) {
159
173
  console.log(cli.colors.red('Error: Failed to remove model'));
160
174
  console.log();
@@ -195,13 +209,16 @@ async function modelDefault() {
195
209
  if (!keys.includes(answers.modelName)) {
196
210
  console.log(cli.colors.red('Model not found. Available models:'));
197
211
  console.log();
198
- console.log(models);
212
+ models.forEach((model) => {
213
+ console.log(cli.colors.gray(` • ${model.modelName}`));
214
+ });
215
+ console.log();
199
216
  return;
200
217
  }
201
218
 
202
219
  // set
203
220
  await db.config('default', answers.modelName);
204
- console.log(cli.colors.green(`Default model: ${answers.modelName}`));
221
+ console.log(cli.colors.green(`Default model set to: ${answers.modelName}`));
205
222
  console.log();
206
223
  } catch (e) {
207
224
  console.log(cli.colors.red('Error: Failed to set default model'));
@@ -2,4 +2,7 @@
2
2
  const cli = require('qiao-cli');
3
3
 
4
4
  // cmd
5
- cli.cmd.version(require('../package.json').version, '-v, --version').description('viho').usage('<command>');
5
+ cli.cmd
6
+ .version(require('../package.json').version, '-v, --version')
7
+ .description('A lightweight CLI tool for managing and interacting with AI models')
8
+ .usage('<command>');
package/bin/viho.js CHANGED
@@ -3,11 +3,19 @@
3
3
  // qiao
4
4
  const cli = require('qiao-cli');
5
5
 
6
+ // util
7
+ const { printLogo } = require('../src/util.js');
8
+
6
9
  // cmds
7
10
  require('./viho-model.js');
8
11
  require('./viho-ask.js');
9
12
  require('./viho-chat.js');
10
13
  require('./viho-version.js');
11
14
 
15
+ // print logo if no args or help
16
+ if (process.argv.length === 2 || process.argv.includes('-h') || process.argv.includes('--help')) {
17
+ printLogo();
18
+ }
19
+
12
20
  // parse
13
21
  cli.cmd.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viho",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "A lightweight CLI tool for managing and interacting with AI models",
5
5
  "keywords": [
6
6
  "ai",
@@ -43,5 +43,5 @@
43
43
  "qiao-config": "^5.0.1",
44
44
  "qiao-llm": "^0.2.5"
45
45
  },
46
- "gitHead": "b4d22881578a4da9c83d057f08b044bdd44c692a"
46
+ "gitHead": "23db2534c938db00241234e31de6e3b926168685"
47
47
  }