Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -10,8 +10,11 @@ app.post('/chat', async (req, res) => {
|
|
| 10 |
const { messages, temperature, max_tokens } = req.body;
|
| 11 |
|
| 12 |
try {
|
|
|
|
|
|
|
|
|
|
| 13 |
const response = await axios.post('https://api-inference.huggingface.co/models/codellama/CodeLlama-34b-Instruct-hf', {
|
| 14 |
-
inputs:
|
| 15 |
parameters: {
|
| 16 |
temperature: temperature || 0.7,
|
| 17 |
max_new_tokens: max_tokens || 100
|
|
|
|
| 10 |
const { messages, temperature, max_tokens } = req.body;
|
| 11 |
|
| 12 |
try {
|
| 13 |
+
// Преобразуем массив сообщений в одну строку
|
| 14 |
+
const inputText = messages.map(msg => msg.content).join('\n');
|
| 15 |
+
|
| 16 |
const response = await axios.post('https://api-inference.huggingface.co/models/codellama/CodeLlama-34b-Instruct-hf', {
|
| 17 |
+
inputs: inputText,
|
| 18 |
parameters: {
|
| 19 |
temperature: temperature || 0.7,
|
| 20 |
max_new_tokens: max_tokens || 100
|