randydev commited on
Commit
57676b8
·
verified ·
1 Parent(s): f838f2c

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +28 -0
index.js CHANGED
@@ -3,6 +3,19 @@ const app = express()
3
  const port = 7860
4
  const axios = require('axios')
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  app.get('/', (req, res) => {
7
  res.send('Hello World!')
8
  })
@@ -15,6 +28,21 @@ app.get('/api/test', async (req, res) => {
15
  }
16
  })
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  app.listen(port, () => {
19
  console.log(`Example app listening on port ${port}`)
20
  })
 
3
  const port = 7860
4
  const axios = require('axios')
5
 
6
+ const headers_gpt = {
7
+ "Accept": "application/json",
8
+ "Content-Type": "application/json",
9
+ "Accept-Language": "en",
10
+ "Connection": "keep-alive",
11
+ "Origin": "https://remix.ethereum.org/",
12
+ "Referer": "https://remix.ethereum.org/",
13
+ "Sec-Fetch-Dest": "empty",
14
+ "Sec-Fetch-Mode": "cors",
15
+ "Sec-Fetch-Site": "cross-site",
16
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
17
+ }
18
+
19
  app.get('/', (req, res) => {
20
  res.send('Hello World!')
21
  })
 
28
  }
29
  })
30
 
31
+ /*
32
+ app.post('/api/chatgpt-old', async (req, res) => {
33
+ try {
34
+ query = req.params.query
35
+ const payload = {"prompt": query}
36
+ const type_urls = "openai-gpt"
37
+ const url = "https://${type_urls}.remixproject.org"
38
+ await axios.post(url, payload, {headersGPT})
39
+ res.json({message: "Hello world"})
40
+ } catch (error) {
41
+ res.status(401).json({error: error.message})
42
+ }
43
+ })
44
+ */
45
+
46
  app.listen(port, () => {
47
  console.log(`Example app listening on port ${port}`)
48
  })