randydev commited on
Commit
84335ae
·
verified ·
1 Parent(s): 0ed80b5

Update plugins/gptold.js

Browse files
Files changed (1) hide show
  1. plugins/gptold.js +13 -0
plugins/gptold.js CHANGED
@@ -741,6 +741,12 @@ GptRoutes.get('/api/v1/ai/akenox/aigen-v1', authenticateApiKeyPremium, apiLimite
741
  * description: User's input query
742
  * schema:
743
  * type: string
 
 
 
 
 
 
744
  * - in: header
745
  * name: x-api-key
746
  * required: true
@@ -754,9 +760,16 @@ GptRoutes.get('/api/v1/ai/akenox/aigen-v1', authenticateApiKeyPremium, apiLimite
754
  GptRoutes.get('/api/v1/ai/akenox/aigen-v2', authenticateApiKeyPremium, apiLimiter, async (req, res) => {
755
  try {
756
  const query = req.query.query;
 
757
  if (!query) {
758
  return res.status(500).json({ error: "query required" });
759
  }
 
 
 
 
 
 
760
  const results = await AlibabaTogether(query, {
761
  system_prompt: SYSTEMAIGENV2
762
  });
 
741
  * description: User's input query
742
  * schema:
743
  * type: string
744
+ * - in: query
745
+ * name: isJson
746
+ * required: true
747
+ * description: Format JSON
748
+ * schema:
749
+ * type: boolean
750
  * - in: header
751
  * name: x-api-key
752
  * required: true
 
760
  GptRoutes.get('/api/v1/ai/akenox/aigen-v2', authenticateApiKeyPremium, apiLimiter, async (req, res) => {
761
  try {
762
  const query = req.query.query;
763
+ const isJson = req.query.isJson || false:
764
  if (!query) {
765
  return res.status(500).json({ error: "query required" });
766
  }
767
+ if (isJson) {
768
+ const results_json = await AlibabaTogether(query, {
769
+ system_prompt: SYSTEMAIGENV2
770
+ });
771
+ return res.json({ JSON.parse(results_json) });
772
+ }
773
  const results = await AlibabaTogether(query, {
774
  system_prompt: SYSTEMAIGENV2
775
  });