File size: 1,587 Bytes
d04e364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import axios from "axios";

export const config =     {
  "name" : "liner",
  "url" : "/api/liner",
  "description" : "Get response from liner AI. Liner Ai is a very powerful AI that can do a lot of things. It have access to real time internet! It can provide you with the latest news, weather, and more.",
  "query" : "prompt",
  "response" : "text",
  "testURL" : "./api/liner?prompt=hello"
}
const headers = {
  Cookie:
    "ab180ClientId=d124745c-b8e0-44c9-8712-82056e1571ed; __stripe_mid=ad30335b-6b5e-4340-8ceb-ac91d6b8cc34a0a896; __stripe_sid=18e0d0e2-0b72-4a6c-8859-ee62b3dcfd02c953ea; connect.sid=s%3AZpWUIMuuF7jh09Z7QriboFEE2chRqxxF.VYhAtox3jyd6ECn2tPDci4e4oSNPicTovuHyOJBv4Wo; _ga_9RRDSJXHYC=GS1.1.1709884220.1.1.1709884314.59.0.0; _ga_67C29LFSEM=GS1.1.1709884222.1.1.1709884316.57.0.1264912748; _dd_s=rum=0&expire=null; amp_ac9120=byJG3kKNpv1SoxEYhgl-ki.OTA4MzY3MQ==..1hoeglaf8.1hoegpbgo.1f.3.1i",
  "Content-Type": "application/json",
};
export default function handler(req, res) {
  let prompt = req.query.prompt;
  const data = {
    spaceId: 18572253,
    threadId: "57117968",
    userMessageId: 69370497,
    userId: 9083671,
    experimentId: 56,
    query: " " + prompt,
    agentId: "@liner",
    platform: "web",
    regenerate: false,
    showReferenceChunks: true,
  };

  // Make POST request
  axios
    .post("https://getliner.com/platform/copilot/v3/answer", data, { headers })
    .then((response) => {
      let da = response.data.split("\n");
      console.log(da[da.length - 2]);
      res.status(200).json( JSON.parse(da[da.length - 2]));
    });

  
}