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.
Files changed (3) hide show
  1. package/cli.js +1 -0
  2. package/index.js +11 -7
  3. 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 = question;
48
- if (includeHistory && conversationHistory.length > 0) {
49
- // Create a context with the current question added to history
50
- const contextWithHistory = [...conversationHistory, { role: 'user', content: question }];
51
- prompt = contextWithHistory.map(msg => `${msg.role}: ${msg.content}`).join('\n\n');
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, just use the question directly
54
- prompt = question;
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuangs",
3
- "version": "1.3.17",
3
+ "version": "1.3.19",
4
4
  "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {