dotaevo-linux-do commited on
Commit
305e055
·
1 Parent(s): e090816

modified: server.js

Browse files
Files changed (1) hide show
  1. server.js +2 -2
server.js CHANGED
@@ -211,7 +211,7 @@ app.post('/v1/messages', async (req, res) =>
211
  method: 'POST',
212
  headers: {
213
  'Content-Type': 'application/json',
214
- Authorization: auth,
215
  },
216
  body: JSON.stringify(openaiReq),
217
  });
@@ -246,7 +246,7 @@ app.post('/v1/messages', async (req, res) =>
246
  }
247
  catch (e)
248
  {
249
- answerObj = await tryToFixJson(raw);
250
  if(!answerObj)
251
  {
252
  logText += `[JsonFailed]\nRaw:\n${raw}\nError:\n${e.message}\n`;
 
211
  method: 'POST',
212
  headers: {
213
  'Content-Type': 'application/json',
214
+ Authorization: `Bearer ${modelMap[body.model].key}`,
215
  },
216
  body: JSON.stringify(openaiReq),
217
  });
 
246
  }
247
  catch (e)
248
  {
249
+ answerObj = await tryToFixJson(`Bearer ${modelMap[body.model].key}`, raw);
250
  if(!answerObj)
251
  {
252
  logText += `[JsonFailed]\nRaw:\n${raw}\nError:\n${e.message}\n`;