Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -192,7 +192,7 @@ async def chat(request: MessageRequest):
|
|
| 192 |
return {"response": "Unsupported language selected."}
|
| 193 |
response = handle_query(message) # Process the message
|
| 194 |
try:
|
| 195 |
-
|
| 196 |
except Exception as e:
|
| 197 |
# Handle translation errors
|
| 198 |
print(f"Translation error: {e}")
|
|
@@ -205,7 +205,7 @@ async def chat(request: MessageRequest):
|
|
| 205 |
"timestamp": datetime.datetime.now().isoformat()
|
| 206 |
}
|
| 207 |
chat_history.append(message_data)
|
| 208 |
-
return {"response":
|
| 209 |
|
| 210 |
@app.get("/")
|
| 211 |
def read_root(request: Request):
|
|
|
|
| 192 |
return {"response": "Unsupported language selected."}
|
| 193 |
response = handle_query(message) # Process the message
|
| 194 |
try:
|
| 195 |
+
response1 = translator.translate(response, dest=language_code).text
|
| 196 |
except Exception as e:
|
| 197 |
# Handle translation errors
|
| 198 |
print(f"Translation error: {e}")
|
|
|
|
| 205 |
"timestamp": datetime.datetime.now().isoformat()
|
| 206 |
}
|
| 207 |
chat_history.append(message_data)
|
| 208 |
+
return {"response": response1}
|
| 209 |
|
| 210 |
@app.get("/")
|
| 211 |
def read_root(request: Request):
|