Rooni commited on
Commit
d9c17f2
1 Parent(s): 448464d

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +9 -8
server.js CHANGED
@@ -1,13 +1,14 @@
1
  const express = require('express');
2
- const bodyParser = require('body-parser');
3
-
4
  const app = express();
5
- const port = 3000;
 
 
6
 
7
  app.use(express.json());
8
 
9
- app.post('/generate', async (req, res) => {
10
- const { messages, temperature, max_tokens } = req.body;
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(port, () => {
44
- console.log(`Сервер запущен на порту ${port}`);
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
+ });