yuangs 1.3.17 → 1.3.19
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 +1 -0
- package/index.js +11 -7
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ function printHelp() {
|
|
|
19
19
|
console.log(` ${chalk.green('list')} 列出所有应用链接`);
|
|
20
20
|
console.log(` ${chalk.green('ai')} "<问题>" 向 AI 提问(不写问题进入交互模式)`);
|
|
21
21
|
console.log(` ${chalk.gray('--model, -m <模型名称>')} 指定 AI 模型 (可选)`);
|
|
22
|
+
console.log(` ${chalk.gray('-p -f -l')} 指定 pro,flash,lite 模型 (可选)`);
|
|
22
23
|
console.log(` ${chalk.green('help')} 显示帮助信息\n`);
|
|
23
24
|
console.log(chalk.bold('AI 交互模式命令:'));
|
|
24
25
|
console.log(` ${chalk.gray('/clear')} 清空对话历史`);
|
package/index.js
CHANGED
|
@@ -44,14 +44,18 @@ async function getAIAnswer(question, model, includeHistory = true) {
|
|
|
44
44
|
const url = 'https://aiproxy.want.biz/ai/explain';
|
|
45
45
|
|
|
46
46
|
// Prepare the prompt with conversation history if enabled
|
|
47
|
-
let prompt
|
|
48
|
-
if (includeHistory
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
let prompt;
|
|
48
|
+
if (includeHistory) {
|
|
49
|
+
prompt = JSON.stringify({
|
|
50
|
+
history: conversationHistory,
|
|
51
|
+
query: question
|
|
52
|
+
}, null, 2);
|
|
52
53
|
} else {
|
|
53
|
-
// If not including history,
|
|
54
|
-
prompt =
|
|
54
|
+
// If not including history, still use JSON format for consistency but with empty history
|
|
55
|
+
prompt = JSON.stringify({
|
|
56
|
+
history: [],
|
|
57
|
+
query: question
|
|
58
|
+
}, null, 2);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
const headers = {
|