Update plugins/gptold.js
Browse files- plugins/gptold.js +14 -5
plugins/gptold.js
CHANGED
@@ -15,13 +15,19 @@ const GptRoutes = express.Router();
|
|
15 |
* - in: query
|
16 |
* name: query
|
17 |
* required: true
|
18 |
-
* description:
|
19 |
* schema:
|
20 |
* type: string
|
21 |
* - in: query
|
22 |
* name: system_prompt
|
23 |
* required: false
|
24 |
-
* description:
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
* schema:
|
26 |
* type: string
|
27 |
* - in: header
|
@@ -37,11 +43,14 @@ const GptRoutes = express.Router();
|
|
37 |
GptRoutes.get('/api/v1/ai/cohere/command-plus', authenticateApiKeyPremium, apiLimiter, async (req, res) => {
|
38 |
try {
|
39 |
const query = req.query.query;
|
40 |
-
|
41 |
-
system_prompt = req.query.system_prompt
|
|
|
42 |
const results = await CohereAI(query, {
|
43 |
-
system_prompt: system_prompt
|
|
|
44 |
});
|
|
|
45 |
res.json({ results });
|
46 |
} catch (error) {
|
47 |
res.status(401).json({ error: error.message });
|
|
|
15 |
* - in: query
|
16 |
* name: query
|
17 |
* required: true
|
18 |
+
* description: User's input query
|
19 |
* schema:
|
20 |
* type: string
|
21 |
* - in: query
|
22 |
* name: system_prompt
|
23 |
* required: false
|
24 |
+
* description: Custom system prompt
|
25 |
+
* schema:
|
26 |
+
* type: string
|
27 |
+
* - in: query
|
28 |
+
* name: chatHistory
|
29 |
+
* required: false
|
30 |
+
* description: Previous chat history in JSON format
|
31 |
* schema:
|
32 |
* type: string
|
33 |
* - in: header
|
|
|
43 |
GptRoutes.get('/api/v1/ai/cohere/command-plus', authenticateApiKeyPremium, apiLimiter, async (req, res) => {
|
44 |
try {
|
45 |
const query = req.query.query;
|
46 |
+
const chatHistory = req.query.chatHistory ? JSON.parse(req.query.chatHistory) : [];
|
47 |
+
const system_prompt = req.query.system_prompt || "Your name is AkenoX AI A kind and friendly AI assistant that answers in a short and concise answer. Give short step-by-step reasoning if required.";
|
48 |
+
|
49 |
const results = await CohereAI(query, {
|
50 |
+
system_prompt: system_prompt,
|
51 |
+
chatHistory: chatHistory
|
52 |
});
|
53 |
+
|
54 |
res.json({ results });
|
55 |
} catch (error) {
|
56 |
res.status(401).json({ error: error.message });
|