Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
| 1 |
const express = require('express');
|
| 2 |
-
const
|
| 3 |
-
|
| 4 |
const app = express();
|
| 5 |
-
const
|
|
|
|
|
|
|
| 6 |
|
| 7 |
app.use(express.json());
|
| 8 |
|
| 9 |
-
app.post('/
|
| 10 |
-
|
| 11 |
|
| 12 |
try {
|
| 13 |
const { default: fetch } = await import('node-fetch');
|
|
@@ -40,6 +41,6 @@ app.post('/generate', async (req, res) => {
|
|
| 40 |
}
|
| 41 |
});
|
| 42 |
|
| 43 |
-
app.listen(
|
| 44 |
-
|
| 45 |
-
});
|
|
|
|
| 1 |
const express = require('express');
|
| 2 |
+
const axios = require('axios');
|
|
|
|
| 3 |
const app = express();
|
| 4 |
+
const PORT = process.env.PORT || 7860;
|
| 5 |
+
const targetUrl = 'https://geminiyufi.vercel.app/v1/chat/completions';
|
| 6 |
+
const apiToken = process.env.API_KEY;
|
| 7 |
|
| 8 |
app.use(express.json());
|
| 9 |
|
| 10 |
+
app.post('/chat', async (req, res) => {
|
| 11 |
+
const { messages, temperature, max_tokens } = req.body;
|
| 12 |
|
| 13 |
try {
|
| 14 |
const { default: fetch } = await import('node-fetch');
|
|
|
|
| 41 |
}
|
| 42 |
});
|
| 43 |
|
| 44 |
+
app.listen(PORT, () => {
|
| 45 |
+
console.log(`Server is running on port ${PORT}`);
|
| 46 |
+
});
|