yuangs 1.3.17 → 1.3.18

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/index.js +11 -7
  2. package/package.json +1 -1
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.18",
4
4
  "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {