Update app.py
Browse files
app.py
CHANGED
|
@@ -64,7 +64,6 @@ async def generate_response(message, max_tokens, temperature):
|
|
| 64 |
{"role": "system", "content": system_message},
|
| 65 |
{"role": "user", "content": message}
|
| 66 |
]
|
| 67 |
-
|
| 68 |
try:
|
| 69 |
# Invoca il modello Hugging Face
|
| 70 |
stream = client.chat.completions.create(
|
|
@@ -83,6 +82,7 @@ async def generate_response(message, max_tokens, temperature):
|
|
| 83 |
|
| 84 |
# Rimuovi formattazioni multilinea e restituisci in una sola riga
|
| 85 |
response = response.replace("\n", " ").strip()
|
|
|
|
| 86 |
return response
|
| 87 |
except Exception as e:
|
| 88 |
raise HTTPException(status_code=500, detail=f"Errore nell'elaborazione: {str(e)}")
|
|
|
|
| 64 |
{"role": "system", "content": system_message},
|
| 65 |
{"role": "user", "content": message}
|
| 66 |
]
|
|
|
|
| 67 |
try:
|
| 68 |
# Invoca il modello Hugging Face
|
| 69 |
stream = client.chat.completions.create(
|
|
|
|
| 82 |
|
| 83 |
# Rimuovi formattazioni multilinea e restituisci in una sola riga
|
| 84 |
response = response.replace("\n", " ").strip()
|
| 85 |
+
print(response)
|
| 86 |
return response
|
| 87 |
except Exception as e:
|
| 88 |
raise HTTPException(status_code=500, detail=f"Errore nell'elaborazione: {str(e)}")
|