Update app.py
Browse files
app.py
CHANGED
|
@@ -565,26 +565,28 @@ async def chat_completions(
|
|
| 565 |
print(fetch_response.text)
|
| 566 |
|
| 567 |
# Process response
|
| 568 |
-
response_data = fetch_response.json()
|
| 569 |
-
logger.info(
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
)
|
| 581 |
|
| 582 |
-
# Extract message content
|
| 583 |
-
chat_message = (
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
)
|
|
|
|
|
|
|
| 588 |
|
| 589 |
if not chat_message:
|
| 590 |
logger.error(f"[{request_id}] E2B did not return a valid response")
|
|
|
|
| 565 |
print(fetch_response.text)
|
| 566 |
|
| 567 |
# Process response
|
| 568 |
+
# response_data = fetch_response.json()
|
| 569 |
+
# logger.info(
|
| 570 |
+
# f"[{request_id}] Received E2B response: {fetch_response.status_code}, "
|
| 571 |
+
# f"time: {(fetch_end_time - fetch_start_time) * 1000:.0f}ms",
|
| 572 |
+
# {
|
| 573 |
+
# "status": fetch_response.status_code,
|
| 574 |
+
# "has_code": bool(response_data.get("code")),
|
| 575 |
+
# "has_text": bool(response_data.get("text")),
|
| 576 |
+
# "response_preview": (response_data.get("code", "") or
|
| 577 |
+
# response_data.get("text", "") or
|
| 578 |
+
# "")[:100] + "..."
|
| 579 |
+
# }
|
| 580 |
+
# )
|
| 581 |
|
| 582 |
+
# # Extract message content
|
| 583 |
+
# chat_message = (
|
| 584 |
+
# response_data.get("code", "").strip() or
|
| 585 |
+
# response_data.get("text", "").strip() or
|
| 586 |
+
# (response_data.strip() if isinstance(response_data, str) else None)
|
| 587 |
+
# )
|
| 588 |
+
|
| 589 |
+
chat_message = fetch_response.text
|
| 590 |
|
| 591 |
if not chat_message:
|
| 592 |
logger.error(f"[{request_id}] E2B did not return a valid response")
|