Update app.py
Browse files
app.py
CHANGED
|
@@ -102,9 +102,9 @@ def generate(req: PromptRequest):
|
|
| 102 |
if "choices" in chunk:
|
| 103 |
output_text += chunk["choices"][0]["text"]
|
| 104 |
|
| 105 |
-
logger.info(f"Prompt processed successfully: {req.prompt[:50]}...")
|
| 106 |
return {"response": output_text}
|
| 107 |
|
| 108 |
except Exception as e:
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
| 102 |
if "choices" in chunk:
|
| 103 |
output_text += chunk["choices"][0]["text"]
|
| 104 |
|
|
|
|
| 105 |
return {"response": output_text}
|
| 106 |
|
| 107 |
except Exception as e:
|
| 108 |
+
# Instead of raising 500, return JSON with error
|
| 109 |
+
print("❌ Error during generation:", e)
|
| 110 |
+
return {"error": str(e)}
|