Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -5,7 +5,12 @@ const axios = require('axios');
|
|
| 5 |
const app = express();
|
| 6 |
app.use(express.json());
|
| 7 |
|
| 8 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
const limiter = rateLimit({
|
| 11 |
windowMs: 45 * 1000, // 30 секунд
|
|
@@ -58,11 +63,11 @@ app.post('/gn', async (req, res) => {
|
|
| 58 |
try {
|
| 59 |
const response = await axios.post('https://geminiyufi.vercel.app/v1/chat/completions', {
|
| 60 |
messages: [{'role': 'system', 'content': start}, {'role': 'user', 'content': prompt}],
|
| 61 |
-
max_tokens:
|
| 62 |
-
model: "gemini-1.5-pro-
|
| 63 |
}, {
|
| 64 |
headers: {
|
| 65 |
-
'Authorization': `Bearer ${
|
| 66 |
'Content-Type': 'application/json',
|
| 67 |
},
|
| 68 |
});
|
|
|
|
| 5 |
const app = express();
|
| 6 |
app.use(express.json());
|
| 7 |
|
| 8 |
+
const openai_keys = process.env.OPENAI_KEY.split(',');
|
| 9 |
+
|
| 10 |
+
function getRandomApiKey() {
|
| 11 |
+
const randomIndex = Math.floor(Math.random() * openai_keys.length);
|
| 12 |
+
return openai_keys[randomIndex];
|
| 13 |
+
}
|
| 14 |
|
| 15 |
const limiter = rateLimit({
|
| 16 |
windowMs: 45 * 1000, // 30 секунд
|
|
|
|
| 63 |
try {
|
| 64 |
const response = await axios.post('https://geminiyufi.vercel.app/v1/chat/completions', {
|
| 65 |
messages: [{'role': 'system', 'content': start}, {'role': 'user', 'content': prompt}],
|
| 66 |
+
max_tokens: 5000,
|
| 67 |
+
model: "gemini-1.5-pro-002",
|
| 68 |
}, {
|
| 69 |
headers: {
|
| 70 |
+
'Authorization': `Bearer ${getRandomApiKey()}`,
|
| 71 |
'Content-Type': 'application/json',
|
| 72 |
},
|
| 73 |
});
|