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.
- package/index.js +11 -7
- 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
|
|
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 = {
|