shenxiang-ai-cli 0.5.4 → 0.5.6

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.
Files changed (2) hide show
  1. package/dist/index.js +88 -71
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { Command } from "commander";
5
5
 
6
6
  // src/commands/chat.ts
7
- import inquirer from "inquirer";
7
+ import inquirer2 from "inquirer";
8
8
  import fs5 from "fs/promises";
9
9
  import path5 from "path";
10
10
  import { glob as glob4 } from "glob";
@@ -1289,6 +1289,9 @@ var gitLogTool = {
1289
1289
  requiresConfirmation: false
1290
1290
  };
1291
1291
 
1292
+ // src/core/tools/index.ts
1293
+ import inquirer from "inquirer";
1294
+
1292
1295
  // src/i18n/zh.ts
1293
1296
  var zh = {
1294
1297
  welcome: "\u6B22\u8FCE\u4F7F\u7528\u6C88\u7FD4\u7684AI\u52A9\u624B \u2014 \u4F60\u7684AI\u5168\u6808\u5F00\u53D1\u642D\u6863",
@@ -1440,25 +1443,6 @@ function t(key, params) {
1440
1443
  return value.replace(/\{(\w+)\}/g, (_, k) => params[k] ?? `{${k}}`);
1441
1444
  }
1442
1445
 
1443
- // src/utils/input.ts
1444
- var _questionFn = null;
1445
- function registerQuestionFn(fn) {
1446
- _questionFn = fn;
1447
- }
1448
- async function askQuestion(prompt) {
1449
- if (_questionFn) {
1450
- return _questionFn(prompt);
1451
- }
1452
- return new Promise((resolve) => {
1453
- process.stdout.write(prompt);
1454
- const onData = (data) => {
1455
- process.stdin.removeListener("data", onData);
1456
- resolve(data.toString().trim());
1457
- };
1458
- process.stdin.once("data", onData);
1459
- });
1460
- }
1461
-
1462
1446
  // src/core/tools/index.ts
1463
1447
  var toolRegistry = /* @__PURE__ */ new Map();
1464
1448
  var _yoloMode = false;
@@ -1496,10 +1480,18 @@ async function confirmExecution(toolName, args) {
1496
1480
  else if (toolName === "edit_file") description = `\u7F16\u8F91\u6587\u4EF6: ${args.path}`;
1497
1481
  else if (toolName === "delete_file") description = `\u5220\u9664\u6587\u4EF6: ${args.path}`;
1498
1482
  else if (toolName === "git_commit") description = `Git\u63D0\u4EA4: ${args.message}`;
1499
- const answer = await askQuestion(` \u26A1 ${description}
1500
- \u5141\u8BB8\u6267\u884C\uFF1F(Y/n) `);
1501
- const a = answer.toLowerCase().trim();
1502
- return a === "" || a === "y" || a === "yes";
1483
+ console.log(theme.warning(` \u26A1 ${description}`));
1484
+ const { confirmation } = await inquirer.prompt([{
1485
+ type: "list",
1486
+ name: "confirmation",
1487
+ message: "\u662F\u5426\u5141\u8BB8\u6267\u884C?",
1488
+ choices: [
1489
+ { name: "\u540C\u610F\u6267\u884C (Yes)", value: true },
1490
+ { name: "\u62D2\u7EDD\u6267\u884C (No)", value: false }
1491
+ ],
1492
+ default: true
1493
+ }]);
1494
+ return confirmation;
1503
1495
  }
1504
1496
  async function executeTool(name, args, autoConfirm = false) {
1505
1497
  const tool = toolRegistry.get(name);
@@ -1869,10 +1861,10 @@ var Agent = class {
1869
1861
  process.stdout.write("\n" + theme.dim(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500") + "\n");
1870
1862
  }
1871
1863
  if (!spinner.isSpinning && spinnerStopped) {
1872
- spinner.text = "AI \u6B63\u5728\u751F\u6210\u4EE3\u7801...";
1864
+ spinner.text = "AI \u6B63\u5728\u601D\u8003...";
1873
1865
  spinner.start();
1874
1866
  }
1875
- }, 1500);
1867
+ }, 800);
1876
1868
  };
1877
1869
  const clearIdleTimer = () => {
1878
1870
  if (idleTimer) {
@@ -1928,7 +1920,7 @@ var Agent = class {
1928
1920
  }
1929
1921
  if (!toolSpinnerStarted) {
1930
1922
  if (hasTextOutput) process.stdout.write("\n");
1931
- spinner.text = "\u6B63\u5728\u51C6\u5907\u64CD\u4F5C...";
1923
+ spinner.text = "\u6B63\u5728\u89C4\u5212\u64CD\u4F5C...";
1932
1924
  spinner.start();
1933
1925
  toolSpinnerStarted = true;
1934
1926
  }
@@ -1937,7 +1929,6 @@ var Agent = class {
1937
1929
  if (chunk.toolCallInfo) {
1938
1930
  const fnName = chunk.toolCallInfo.functionName || "";
1939
1931
  const delta = chunk.toolCallInfo.argumentsDelta || "";
1940
- const size = chunk.toolCallInfo.argumentsLength || 0;
1941
1932
  if (!toolSpinnerStarted || spinner.isSpinning && delta) {
1942
1933
  if (spinner.isSpinning) spinner.stop();
1943
1934
  if (!toolSpinnerStarted) {
@@ -1948,7 +1939,7 @@ var Agent = class {
1948
1939
  process.stdout.write(theme.tool(`
1949
1940
  \u25B8 ${name}
1950
1941
  `));
1951
- this._codeStreamState = { inContent: false, buffer: "", escaping: false };
1942
+ this._codeStreamState = { inContent: false, buffer: "", escaping: false, keyBuffer: "", inKey: false, afterColon: false };
1952
1943
  }
1953
1944
  }
1954
1945
  if (delta && this._codeStreamState) {
@@ -2226,7 +2217,7 @@ function showBanner() {
2226
2217
  console.clear();
2227
2218
  const p = chalk3.hex("#A78BFA");
2228
2219
  const w = chalk3.white;
2229
- const version = "v0.5.4";
2220
+ const version = "v0.5.6";
2230
2221
  const avatarLines = [
2231
2222
  ` ${p("\u2584\u2580\u2580\u2580\u2584")}`,
2232
2223
  ` ${p("\u2588")} ${w("\u2580")} ${w("\u2580")} ${p("\u2588")}`,
@@ -2236,7 +2227,8 @@ function showBanner() {
2236
2227
  ];
2237
2228
  const terminalWidth = process.stdout.columns || 80;
2238
2229
  const boxWidth = Math.max(60, Math.min(terminalWidth - 4, 120));
2239
- const leftColWidth = Math.floor(boxWidth * 0.45);
2230
+ const leftColWidth = Math.floor(boxWidth * 0.35);
2231
+ const rightColWidth = boxWidth - leftColWidth - 4;
2240
2232
  const leftContent = [
2241
2233
  "",
2242
2234
  " Welcome back!",
@@ -2247,6 +2239,25 @@ function showBanner() {
2247
2239
  ` ${chalk3.dim(process.cwd().length > leftColWidth - 2 ? "..." + process.cwd().slice(-(leftColWidth - 5)) : process.cwd())}`,
2248
2240
  ""
2249
2241
  ];
2242
+ const wrapText = (text, width) => {
2243
+ const words = text.split("");
2244
+ const lines2 = [];
2245
+ let currentLine = "";
2246
+ for (const char of words) {
2247
+ const charWidth = char.codePointAt(0) > 255 ? 2 : 1;
2248
+ const currentLineWidth = currentLine.split("").reduce((acc, c) => acc + (c.codePointAt(0) > 255 ? 2 : 1), 0);
2249
+ if (currentLineWidth + charWidth > width) {
2250
+ lines2.push(currentLine);
2251
+ currentLine = char;
2252
+ } else {
2253
+ currentLine += char;
2254
+ }
2255
+ }
2256
+ if (currentLine) lines2.push(currentLine);
2257
+ return lines2;
2258
+ };
2259
+ const quote = "\u5343\u4E07\u522B\u8DDF\u8BA4\u77E5\u4E0D\u540C\u9891\u7684\u4EBA\u4E89\u8BBA\uFF0C\u66F4\u522B\u548C\u4ED6\u4EEC\u8BA1\u8F83\uFF0C\u771F\u6B63\u7684\u806A\u660E\uFF0C\u662F\u61C2\u5F97\u7B5B\u9009\uFF0C\u800C\u4E0D\u662F\u8BD5\u56FE\u6539\u53D8";
2260
+ const wrappedQuote = wrapText(quote, rightColWidth - 2);
2250
2261
  const rightContent = [
2251
2262
  theme.brand("Tips for getting started"),
2252
2263
  `Run ${theme.code("/help")} for a list of commands`,
@@ -2254,7 +2265,7 @@ function showBanner() {
2254
2265
  theme.brand("Recent activity"),
2255
2266
  "No recent activity",
2256
2267
  "",
2257
- "",
2268
+ ...wrappedQuote.map((l) => theme.dim(l)),
2258
2269
  ""
2259
2270
  ];
2260
2271
  const maxLines = Math.max(leftContent.length, rightContent.length);
@@ -2278,6 +2289,12 @@ function showBanner() {
2278
2289
  }));
2279
2290
  }
2280
2291
 
2292
+ // src/utils/input.ts
2293
+ var _questionFn = null;
2294
+ function registerQuestionFn(fn) {
2295
+ _questionFn = fn;
2296
+ }
2297
+
2281
2298
  // src/commands/chat.ts
2282
2299
  async function chatCommand(options = {}) {
2283
2300
  const config3 = getConfig();
@@ -2315,7 +2332,7 @@ async function chatCommand(options = {}) {
2315
2332
  console.log();
2316
2333
  }
2317
2334
  registerQuestionFn(async (prompt) => {
2318
- const { answer } = await inquirer.prompt([{
2335
+ const { answer } = await inquirer2.prompt([{
2319
2336
  type: "input",
2320
2337
  name: "answer",
2321
2338
  message: prompt,
@@ -2365,7 +2382,7 @@ async function chatCommand(options = {}) {
2365
2382
  while (true) {
2366
2383
  let input;
2367
2384
  try {
2368
- const result = await inquirer.prompt([{
2385
+ const result = await inquirer2.prompt([{
2369
2386
  type: "input",
2370
2387
  name: "input",
2371
2388
  message: theme.user("\u4F60:"),
@@ -2400,20 +2417,20 @@ async function chatCommand(options = {}) {
2400
2417
  }
2401
2418
  async function doInlineRegister() {
2402
2419
  const config3 = getConfig();
2403
- const { email } = await inquirer.prompt([{
2420
+ const { email } = await inquirer2.prompt([{
2404
2421
  type: "input",
2405
2422
  name: "email",
2406
2423
  message: "\u90AE\u7BB1:",
2407
2424
  validate: (v) => v.includes("@") ? true : "\u8BF7\u8F93\u5165\u6709\u6548\u7684\u90AE\u7BB1"
2408
2425
  }]);
2409
- const { password } = await inquirer.prompt([{
2426
+ const { password } = await inquirer2.prompt([{
2410
2427
  type: "password",
2411
2428
  name: "password",
2412
2429
  message: "\u8BBE\u7F6E\u5BC6\u7801 (\u81F3\u5C116\u4F4D):",
2413
2430
  mask: "*",
2414
2431
  validate: (v) => v.length >= 6 ? true : "\u5BC6\u7801\u81F3\u5C116\u4F4D"
2415
2432
  }]);
2416
- const { name } = await inquirer.prompt([{
2433
+ const { name } = await inquirer2.prompt([{
2417
2434
  type: "input",
2418
2435
  name: "name",
2419
2436
  message: "\u6635\u79F0:",
@@ -2665,19 +2682,19 @@ function fmtTokens(n) {
2665
2682
  }
2666
2683
 
2667
2684
  // src/commands/config.ts
2668
- import inquirer2 from "inquirer";
2685
+ import inquirer3 from "inquirer";
2669
2686
  async function configCommand() {
2670
2687
  const config3 = getConfig();
2671
2688
  console.log(`
2672
2689
  \u914D\u7F6E\u6587\u4EF6: ${theme.dim(getConfigPath())}
2673
2690
  `);
2674
- const { action } = await inquirer2.prompt([{
2691
+ const { action } = await inquirer3.prompt([{
2675
2692
  type: "list",
2676
2693
  name: "action",
2677
2694
  message: "\u9009\u62E9\u8981\u914D\u7F6E\u7684\u9879\u76EE:",
2678
2695
  choices: [
2679
2696
  { name: "\u{1F916} \u8BBE\u7F6EAI\u6A21\u578B", value: "model" },
2680
- new inquirer2.Separator("\u2500\u2500 API Key \u8BBE\u7F6E \u2500\u2500"),
2697
+ new inquirer3.Separator("\u2500\u2500 API Key \u8BBE\u7F6E \u2500\u2500"),
2681
2698
  { name: "\u{1F319} Kimi \u6708\u4E4B\u6697\u9762", value: "key_kimi" },
2682
2699
  { name: "\u{1F9E0} OpenAI", value: "key_openai" },
2683
2700
  { name: "\u{1F3AD} Anthropic Claude", value: "key_anthropic" },
@@ -2690,7 +2707,7 @@ async function configCommand() {
2690
2707
  { name: "\u26A1 Groq", value: "key_groq" },
2691
2708
  { name: "\u{1F3D4}\uFE0F \u767E\u5DDD Baichuan", value: "key_baichuan" },
2692
2709
  { name: "\u{1F31F} \u96F6\u4E00\u4E07\u7269 Yi", value: "key_lingyiwanwu" },
2693
- new inquirer2.Separator("\u2500\u2500 \u5176\u4ED6\u8BBE\u7F6E \u2500\u2500"),
2710
+ new inquirer3.Separator("\u2500\u2500 \u5176\u4ED6\u8BBE\u7F6E \u2500\u2500"),
2694
2711
  { name: "\u{1F310} \u8BBE\u7F6E\u540E\u7AEF\u670D\u52A1\u5730\u5740", value: "apiBaseUrl" },
2695
2712
  { name: "\u{1F30D} \u8BBE\u7F6E\u754C\u9762\u8BED\u8A00", value: "locale" },
2696
2713
  { name: "\u{1F4CB} \u67E5\u770B\u5F53\u524D\u914D\u7F6E", value: "show" },
@@ -2705,7 +2722,7 @@ async function configCommand() {
2705
2722
  if (currentKey) {
2706
2723
  printInfo(`\u5F53\u524D\u5DF2\u914D\u7F6E ${displayName} Key`);
2707
2724
  }
2708
- const { key } = await inquirer2.prompt([{
2725
+ const { key } = await inquirer3.prompt([{
2709
2726
  type: "password",
2710
2727
  name: "key",
2711
2728
  message: `\u8F93\u5165 ${displayName} API Key:`,
@@ -2727,7 +2744,7 @@ async function configCommand() {
2727
2744
  }
2728
2745
  const choices = [];
2729
2746
  for (const [group, groupModels] of groups) {
2730
- choices.push(new inquirer2.Separator(`\u2500\u2500 ${group} \u2500\u2500`));
2747
+ choices.push(new inquirer3.Separator(`\u2500\u2500 ${group} \u2500\u2500`));
2731
2748
  for (const m of groupModels) {
2732
2749
  choices.push({
2733
2750
  name: `${m.name} (${m.id})`,
@@ -2735,7 +2752,7 @@ async function configCommand() {
2735
2752
  });
2736
2753
  }
2737
2754
  }
2738
- const { model } = await inquirer2.prompt([{
2755
+ const { model } = await inquirer3.prompt([{
2739
2756
  type: "list",
2740
2757
  name: "model",
2741
2758
  message: "\u9009\u62E9AI\u6A21\u578B:",
@@ -2748,7 +2765,7 @@ async function configCommand() {
2748
2765
  break;
2749
2766
  }
2750
2767
  case "apiBaseUrl": {
2751
- const { url } = await inquirer2.prompt([{
2768
+ const { url } = await inquirer3.prompt([{
2752
2769
  type: "input",
2753
2770
  name: "url",
2754
2771
  message: "\u8F93\u5165\u540E\u7AEF\u670D\u52A1\u5730\u5740:",
@@ -2759,7 +2776,7 @@ async function configCommand() {
2759
2776
  break;
2760
2777
  }
2761
2778
  case "locale": {
2762
- const { locale } = await inquirer2.prompt([{
2779
+ const { locale } = await inquirer3.prompt([{
2763
2780
  type: "list",
2764
2781
  name: "locale",
2765
2782
  message: "\u9009\u62E9\u754C\u9762\u8BED\u8A00:",
@@ -2795,12 +2812,12 @@ async function configCommand() {
2795
2812
  }
2796
2813
 
2797
2814
  // src/commands/login.ts
2798
- import inquirer3 from "inquirer";
2815
+ import inquirer4 from "inquirer";
2799
2816
  async function loginCommand() {
2800
2817
  const config3 = getConfig();
2801
2818
  if (config3.authToken && config3.userEmail) {
2802
2819
  printInfo(`\u5F53\u524D\u5DF2\u767B\u5F55: ${config3.userEmail}`);
2803
- const { relogin } = await inquirer3.prompt([{
2820
+ const { relogin } = await inquirer4.prompt([{
2804
2821
  type: "confirm",
2805
2822
  name: "relogin",
2806
2823
  message: "\u662F\u5426\u91CD\u65B0\u767B\u5F55\uFF1F",
@@ -2809,7 +2826,7 @@ async function loginCommand() {
2809
2826
  if (!relogin) return;
2810
2827
  }
2811
2828
  console.log(theme.brandBold("\n\u{1F511} \u767B\u5F55\u6C88\u7FD4\u7684AI\u52A9\u624B\n"));
2812
- const { email } = await inquirer3.prompt([{
2829
+ const { email } = await inquirer4.prompt([{
2813
2830
  type: "input",
2814
2831
  name: "email",
2815
2832
  message: "\u90AE\u7BB1:",
@@ -2818,7 +2835,7 @@ async function loginCommand() {
2818
2835
  return true;
2819
2836
  }
2820
2837
  }]);
2821
- const { password } = await inquirer3.prompt([{
2838
+ const { password } = await inquirer4.prompt([{
2822
2839
  type: "password",
2823
2840
  name: "password",
2824
2841
  message: "\u5BC6\u7801:",
@@ -2844,7 +2861,7 @@ async function loginCommand() {
2844
2861
  console.log();
2845
2862
  } else if (response.status === 404) {
2846
2863
  printInfo("\u8BE5\u90AE\u7BB1\u5C1A\u672A\u6CE8\u518C");
2847
- const { register } = await inquirer3.prompt([{
2864
+ const { register } = await inquirer4.prompt([{
2848
2865
  type: "confirm",
2849
2866
  name: "register",
2850
2867
  message: "\u662F\u5426\u7ACB\u5373\u6CE8\u518C\uFF1F",
@@ -2878,12 +2895,12 @@ async function loginCommand() {
2878
2895
  }
2879
2896
 
2880
2897
  // src/commands/register.ts
2881
- import inquirer4 from "inquirer";
2898
+ import inquirer5 from "inquirer";
2882
2899
  async function registerCommand() {
2883
2900
  const config3 = getConfig();
2884
2901
  if (config3.authToken && config3.userEmail) {
2885
2902
  printInfo(`\u5F53\u524D\u5DF2\u767B\u5F55: ${config3.userEmail}`);
2886
- const { proceed } = await inquirer4.prompt([{
2903
+ const { proceed } = await inquirer5.prompt([{
2887
2904
  type: "confirm",
2888
2905
  name: "proceed",
2889
2906
  message: "\u662F\u5426\u6CE8\u518C\u65B0\u8D26\u6237\uFF1F\uFF08\u5C06\u8986\u76D6\u5F53\u524D\u767B\u5F55\u72B6\u6001\uFF09",
@@ -2892,7 +2909,7 @@ async function registerCommand() {
2892
2909
  if (!proceed) return;
2893
2910
  }
2894
2911
  console.log(theme.brandBold("\n\u{1F4DD} \u6CE8\u518C\u6C88\u7FD4\u7684AI\u52A9\u624B\u8D26\u6237\n"));
2895
- const { email } = await inquirer4.prompt([{
2912
+ const { email } = await inquirer5.prompt([{
2896
2913
  type: "input",
2897
2914
  name: "email",
2898
2915
  message: "\u90AE\u7BB1:",
@@ -2901,13 +2918,13 @@ async function registerCommand() {
2901
2918
  return true;
2902
2919
  }
2903
2920
  }]);
2904
- const { name } = await inquirer4.prompt([{
2921
+ const { name } = await inquirer5.prompt([{
2905
2922
  type: "input",
2906
2923
  name: "name",
2907
2924
  message: "\u6635\u79F0 (\u53EF\u9009):",
2908
2925
  default: email.split("@")[0]
2909
2926
  }]);
2910
- const { password } = await inquirer4.prompt([{
2927
+ const { password } = await inquirer5.prompt([{
2911
2928
  type: "password",
2912
2929
  name: "password",
2913
2930
  message: "\u5BC6\u7801 (\u81F3\u5C116\u4F4D):",
@@ -2917,7 +2934,7 @@ async function registerCommand() {
2917
2934
  return true;
2918
2935
  }
2919
2936
  }]);
2920
- const { confirmPassword } = await inquirer4.prompt([{
2937
+ const { confirmPassword } = await inquirer5.prompt([{
2921
2938
  type: "password",
2922
2939
  name: "confirmPassword",
2923
2940
  message: "\u786E\u8BA4\u5BC6\u7801:",
@@ -3050,7 +3067,7 @@ function progressBar(used, limit, width = 16) {
3050
3067
  }
3051
3068
 
3052
3069
  // src/commands/admin.ts
3053
- import inquirer5 from "inquirer";
3070
+ import inquirer6 from "inquirer";
3054
3071
  async function adminCommand() {
3055
3072
  const config3 = getConfig();
3056
3073
  if (!config3.authToken) {
@@ -3058,7 +3075,7 @@ async function adminCommand() {
3058
3075
  return;
3059
3076
  }
3060
3077
  console.log(theme.brandBold("\n\u2699\uFE0F \u7BA1\u7406\u5458\u63A7\u5236\u53F0\n"));
3061
- const { action } = await inquirer5.prompt([{
3078
+ const { action } = await inquirer6.prompt([{
3062
3079
  type: "list",
3063
3080
  name: "action",
3064
3081
  message: "\u9009\u62E9\u64CD\u4F5C:",
@@ -3145,7 +3162,7 @@ async function listUsers(config3) {
3145
3162
  async function setUserQuota(config3) {
3146
3163
  const users = await fetchUserList(config3);
3147
3164
  if (!users) return;
3148
- const { userId } = await inquirer5.prompt([{
3165
+ const { userId } = await inquirer6.prompt([{
3149
3166
  type: "list",
3150
3167
  name: "userId",
3151
3168
  message: "\u9009\u62E9\u7528\u6237:",
@@ -3155,19 +3172,19 @@ async function setUserQuota(config3) {
3155
3172
  console.log(theme.dim(`
3156
3173
  \u5F53\u524D\u989D\u5EA6: \u65E5\u9650=${selectedUser.dailyLimit}\u6B21 \u6708Token=${fmtTokens3(selectedUser.monthlyTokenLimit)} \u514D\u8D39\u603B\u989D=${fmtTokens3(selectedUser.totalFreeTokens)}
3157
3174
  `));
3158
- const { dailyLimit } = await inquirer5.prompt([{
3175
+ const { dailyLimit } = await inquirer6.prompt([{
3159
3176
  type: "number",
3160
3177
  name: "dailyLimit",
3161
3178
  message: "\u6BCF\u65E5\u8BF7\u6C42\u4E0A\u9650:",
3162
3179
  default: selectedUser.dailyLimit
3163
3180
  }]);
3164
- const { monthlyTokenLimit } = await inquirer5.prompt([{
3181
+ const { monthlyTokenLimit } = await inquirer6.prompt([{
3165
3182
  type: "number",
3166
3183
  name: "monthlyTokenLimit",
3167
3184
  message: "\u6BCF\u6708Token\u4E0A\u9650:",
3168
3185
  default: selectedUser.monthlyTokenLimit
3169
3186
  }]);
3170
- const { totalFreeTokens } = await inquirer5.prompt([{
3187
+ const { totalFreeTokens } = await inquirer6.prompt([{
3171
3188
  type: "number",
3172
3189
  name: "totalFreeTokens",
3173
3190
  message: "\u514D\u8D39Token\u603B\u989D:",
@@ -3193,13 +3210,13 @@ async function setUserQuota(config3) {
3193
3210
  async function setUserPlan(config3) {
3194
3211
  const users = await fetchUserList(config3);
3195
3212
  if (!users) return;
3196
- const { userId } = await inquirer5.prompt([{
3213
+ const { userId } = await inquirer6.prompt([{
3197
3214
  type: "list",
3198
3215
  name: "userId",
3199
3216
  message: "\u9009\u62E9\u7528\u6237:",
3200
3217
  choices: users.map((u) => ({ name: `${u.email} (\u5F53\u524D: ${u.plan})`, value: u.id }))
3201
3218
  }]);
3202
- const { plan } = await inquirer5.prompt([{
3219
+ const { plan } = await inquirer6.prompt([{
3203
3220
  type: "list",
3204
3221
  name: "plan",
3205
3222
  message: "\u9009\u62E9\u8BA1\u5212:",
@@ -3229,7 +3246,7 @@ async function setUserPlan(config3) {
3229
3246
  async function setUserRole(config3) {
3230
3247
  const users = await fetchUserList(config3);
3231
3248
  if (!users) return;
3232
- const { userId } = await inquirer5.prompt([{
3249
+ const { userId } = await inquirer6.prompt([{
3233
3250
  type: "list",
3234
3251
  name: "userId",
3235
3252
  message: "\u9009\u62E9\u7528\u6237:",
@@ -3238,7 +3255,7 @@ async function setUserRole(config3) {
3238
3255
  value: u.id
3239
3256
  }))
3240
3257
  }]);
3241
- const { role } = await inquirer5.prompt([{
3258
+ const { role } = await inquirer6.prompt([{
3242
3259
  type: "list",
3243
3260
  name: "role",
3244
3261
  message: "\u8BBE\u7F6E\u89D2\u8272:",
@@ -3267,7 +3284,7 @@ async function setUserRole(config3) {
3267
3284
  async function resetUsage(config3) {
3268
3285
  const users = await fetchUserList(config3);
3269
3286
  if (!users) return;
3270
- const { userId } = await inquirer5.prompt([{
3287
+ const { userId } = await inquirer6.prompt([{
3271
3288
  type: "list",
3272
3289
  name: "userId",
3273
3290
  message: "\u9009\u62E9\u7528\u6237:",
@@ -3276,7 +3293,7 @@ async function resetUsage(config3) {
3276
3293
  value: u.id
3277
3294
  }))
3278
3295
  }]);
3279
- const { confirm } = await inquirer5.prompt([{
3296
+ const { confirm } = await inquirer6.prompt([{
3280
3297
  type: "confirm",
3281
3298
  name: "confirm",
3282
3299
  message: "\u786E\u5B9A\u8981\u91CD\u7F6E\u8BE5\u7528\u6237\u7684\u7D2F\u8BA1\u7528\u91CF\u5417\uFF1F",
@@ -3301,7 +3318,7 @@ async function resetUsage(config3) {
3301
3318
  async function toggleUserStatus(config3) {
3302
3319
  const users = await fetchUserList(config3);
3303
3320
  if (!users) return;
3304
- const { userId } = await inquirer5.prompt([{
3321
+ const { userId } = await inquirer6.prompt([{
3305
3322
  type: "list",
3306
3323
  name: "userId",
3307
3324
  message: "\u9009\u62E9\u7528\u6237:",
@@ -3370,7 +3387,7 @@ function fmtTokens3(n) {
3370
3387
  var program = new Command();
3371
3388
  var config2 = getConfig();
3372
3389
  setLocale(config2.locale);
3373
- program.name("sxai").description(t("description")).version("0.5.4");
3390
+ program.name("sxai").description(t("description")).version("0.5.6");
3374
3391
  program.command("chat", { isDefault: true }).description("\u542F\u52A8\u4EA4\u4E92\u5F0FAI\u5BF9\u8BDD\uFF08\u9ED8\u8BA4\u547D\u4EE4\uFF09").option("-m, --model <model>", "\u6307\u5B9AAI\u6A21\u578B", config2.model).option("-y, --yolo", "\u81EA\u52A8\u6A21\u5F0F\uFF1A\u8DF3\u8FC7\u6240\u6709\u786E\u8BA4\uFF0C\u8BA9AI\u81EA\u4E3B\u6267\u884C").action(async (options) => {
3375
3392
  if (options.model && options.model !== config2.model) {
3376
3393
  setConfig("model", options.model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shenxiang-ai-cli",
3
- "version": "0.5.4",
3
+ "version": "0.5.6",
4
4
  "description": "沈翔的AI助手 - 终端里的AI全栈开发搭档",
5
5
  "type": "module",
6
6
  "bin": {