yuangs 1.0.9 → 1.1.1
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/cli.js +9 -8
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ function printHelp() {
|
|
|
16
16
|
console.log(` ${chalk.green('ai')} "<问题>" 向 AI 提问`);
|
|
17
17
|
console.log(` ${chalk.gray('--model <模型名称>')} 指定 AI 模型 (可选)`);
|
|
18
18
|
console.log(` ${chalk.green('help')} 显示帮助信息\n`);
|
|
19
|
-
console.log(chalk.gray('AI 示例: yuangs ai "你好" --model gemini-pro'));
|
|
19
|
+
console.log(chalk.gray('AI 示例: yuangs ai "你好" --model gemini-pro-latest'));
|
|
20
20
|
console.log(chalk.gray('普通示例: yuangs shici\n'));
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -56,13 +56,14 @@ async function handleAICommand() {
|
|
|
56
56
|
const answer = await yuangs.getAIAnswer(question, model);
|
|
57
57
|
clearInterval(interval);
|
|
58
58
|
process.stdout.clearLine(0);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
process.stdout.cursorTo(0);
|
|
60
|
+
if (answer && answer.explanation) {
|
|
61
|
+
console.log(chalk.bold.green('🤖 AI 回答:\n'));
|
|
62
|
+
console.log(answer.explanation);
|
|
63
|
+
} else {
|
|
64
|
+
console.log(chalk.yellow('AI 未返回有效内容。')
|
|
65
|
+
);
|
|
66
|
+
}
|
|
66
67
|
} catch (error) {
|
|
67
68
|
clearInterval(interval);
|
|
68
69
|
process.stdout.clearLine(0);
|