Rooni commited on
Commit
7becea8
·
verified ·
1 Parent(s): e576267

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +3 -3
server.js CHANGED
@@ -16,8 +16,8 @@ app.post('/chat', async (req, res) => {
16
  const response = await fetch('https://api-inference.huggingface.co/models/codellama/CodeLlama-34b-Instruct-hf', {
17
  method: 'POST',
18
  headers: {
19
- 'Content-Type': 'application/json',
20
- 'Authorization': `Bearer ${process.env.API_KEY}` // Замените на ваш токен Hugging Face API
21
  },
22
  body: JSON.stringify({
23
  inputs: messages,
@@ -32,7 +32,7 @@ app.post('/chat', async (req, res) => {
32
  const generatedText = data.generated_text;
33
 
34
  // Добавляем сгенерированное сообщение в конец массива messages
35
- messages.push({ role: 'assistant', content: generatedText });
36
 
37
  res.json({ messages });
38
  } catch (error) {
 
16
  const response = await fetch('https://api-inference.huggingface.co/models/codellama/CodeLlama-34b-Instruct-hf', {
17
  method: 'POST',
18
  headers: {
19
+ 'Content-Type': `application/json`,
20
+ 'Authorization': `Bearer ${apiToken}` // Замените на ваш токен Hugging Face API
21
  },
22
  body: JSON.stringify({
23
  inputs: messages,
 
32
  const generatedText = data.generated_text;
33
 
34
  // Добавляем сгенерированное сообщение в конец массива messages
35
+ messages.push({ role: 'assistant', content: data });
36
 
37
  res.json({ messages });
38
  } catch (error) {