yuangs 1.2.0 → 1.2.2

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 (3) hide show
  1. package/README.md +16 -0
  2. package/cli.js +16 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -43,6 +43,7 @@ yuangs ai
43
43
  ```
44
44
 
45
45
  ## 应用列表
46
+ 以下是 CLI 中可以通过相应命令直接打开的应用程序链接:
46
47
 
47
48
  古诗词 PWA: https://wealth.want.biz/shici/index.html
48
49
 
@@ -50,6 +51,21 @@ yuangs ai
50
51
 
51
52
  Pong 游戏: https://wealth.want.biz/pages/pong.html
52
53
 
54
+ ## 更新日志
55
+
56
+ ### v1.2.0 (2025-11-29)
57
+
58
+ * **新增** AI 命令交互模式:直接输入 `yuangs ai` 即可进入一问一答模式,无需每次输入问题。
59
+ * **新增** AI 命令模型参数 `-m` 简写:支持 `-m <模型名称>` 代替 `--model <模型名称>`。
60
+ * **新增** `help` 命令显示仓库地址:方便用户直接访问项目仓库。
61
+ * **优化** AI 请求错误提示:在处理 AI 请求出错时,提供更清晰的错误信息。
62
+
63
+ ### v1.1.x (之前版本,主要更新)
64
+
65
+ * **新增** `ai` 命令:集成 AI 问答功能 (`yuangs ai "你的问题"`)。
66
+ * **新增** `help` 命令显示当前版本号:方便用户了解工具版本。
67
+ * **优化** AI 请求加载动画:在请求过程中显示加载动画和已耗时秒数,并在请求结束后显示总耗时。
68
+
53
69
  ## 维护者
54
70
 
55
71
  yuanguangshan
package/cli.js CHANGED
@@ -92,18 +92,22 @@ async function handleAICommand() {
92
92
  });
93
93
 
94
94
  const askLoop = () => {
95
- rl.question(chalk.green('你:'), async (q) => {
96
- const trimmed = q.trim();
97
- if (!trimmed) {
98
- // 空行就继续问
99
- return askLoop();
100
- }
101
- await askOnce(trimmed, model);
102
- askLoop();
103
- });
104
- };
105
-
106
- askLoop();
95
+ rl.question(chalk.green('你:'), async (q) => {
96
+ const trimmed = q.trim();
97
+
98
+ // ✨ 新增:优雅退出
99
+ if (['exit', 'quit', 'bye'].includes(trimmed.toLowerCase())) {
100
+ console.log(chalk.cyan('👋 再见!'));
101
+ rl.close();
102
+ process.exit(0);
103
+ }
104
+
105
+ if (!trimmed) {
106
+ return askLoop();
107
+ }
108
+ await askOnce(trimmed, model);
109
+ askLoop();
110
+ });
107
111
  return;
108
112
  }
109
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuangs",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {