JiuZZZ commited on
Commit
c78e699
·
verified ·
1 Parent(s): 0f1277d

Update hf.js

Browse files
Files changed (1) hide show
  1. hf.js +25 -0
hf.js CHANGED
@@ -10,6 +10,31 @@ app.use('/hf/v1/chat/completions', createProxyMiddleware({
10
  changeOrigin: true
11
  }));
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  const port = process.env.HF_PORT || 7860;
14
  app.listen(port, () => {
15
  console.log(`HF Proxy server is running at PORT: ${port}`);
 
10
  changeOrigin: true
11
  }));
12
 
13
+ app.get('/', (req, res) => {
14
+ const htmlContent = `
15
+ <!DOCTYPE html>
16
+ <html lang="en">
17
+ <head>
18
+ <meta charset="UTF-8">
19
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
20
+ <title>My Static Page</title>
21
+ </head>
22
+ <body>
23
+ <p> Cursor To OpenAI Server </p>
24
+ <p> 聊天来源: 自定义(兼容 OpenAI) </p>
25
+ <p> 自定义端点(基本URL):<div id="endpoint-url"></div></p>
26
+ <p> 自定义API密钥:「抓取的Cursor Cookie,开头为user_」</p>
27
+ <script>
28
+ const url = new URL(window.location.href);
29
+ const link = url.protocol + '//' + url.host + '/hf/v1';
30
+ document.getElementById('endpoint-url').textContent = 'Dynamic URL: ' + link;
31
+ </script>
32
+ </body>
33
+ </html>
34
+ `;
35
+ res.send(htmlContent);
36
+ });
37
+
38
  const port = process.env.HF_PORT || 7860;
39
  app.listen(port, () => {
40
  console.log(`HF Proxy server is running at PORT: ${port}`);