EmeraldCreator commited on
Commit
100ccc8
·
verified ·
1 Parent(s): 79ef5ed

Create server.js

Browse files
Files changed (1) hide show
  1. server.js +53 -0
server.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const http = require('http');
2
+ const https = require('https');
3
+
4
+ // --- ТВОЯ АТОМАРНАЯ МАСКИРОВКА (LDFLDF4) ---
5
+ const p1 = "g"; const p2 = "s"; const p3 = "k"; const p4 = "_";
6
+ const b1 = "WEvCP81fsMtgvCQcJf3h";
7
+ const b2 = "WGdyb3FY93qrxWRpiYxJ";
8
+ const b3 = "tK1TWKGLD7je";
9
+ const LDFLDF4 = (p1+p2+p3+p4+b1+b2+b3).trim();
10
+
11
+ const server = http.createServer((req, res) => {
12
+ // Убиваем CORS для Хаггинга
13
+ res.setHeader('Access-Control-Allow-Origin', '*');
14
+ res.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
15
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
16
+
17
+ if (req.method === 'OPTIONS') { res.end(); return; }
18
+
19
+ if (req.method === 'POST') {
20
+ let body = '';
21
+ req.on('data', chunk => { body += chunk.toString(); });
22
+ req.on('end', () => {
23
+ const userData = JSON.parse(body);
24
+
25
+ const options = {
26
+ hostname: 'api.groq.com',
27
+ path: '/openai/v1/chat/completions',
28
+ method: 'POST',
29
+ headers: {
30
+ 'Authorization': 'Bearer ' + LDFLDF4,
31
+ 'Content-Type': 'application/json'
32
+ }
33
+ };
34
+
35
+ const groqReq = https.request(options, (groqRes) => {
36
+ let responseData = '';
37
+ groqRes.on('data', (d) => { responseData += d; });
38
+ groqRes.on('end', () => { res.end(responseData); });
39
+ });
40
+
41
+ groqReq.write(JSON.stringify({
42
+ model: "llama3-8b-8192",
43
+ messages: [{ role: "user", content: userData.message }]
44
+ }));
45
+ groqReq.end();
46
+ });
47
+ }
48
+ });
49
+
50
+ // ПОРТ 7860 — Золотой стандарт Hugging Face!
51
+ server.listen(7860, "0.0.0.0", () => {
52
+ console.log("🏙️ Emerald Plus Server в Облаке!");
53
+ });