Spaces:
Sleeping
Sleeping
prompt
Browse files- routers/gemini.py +3 -4
- services/gemini_job_worker.py +4 -2
routers/gemini.py
CHANGED
|
@@ -369,11 +369,10 @@ async def get_job_status(
|
|
| 369 |
|
| 370 |
if job.status == "completed":
|
| 371 |
response["completed_at"] = job.completed_at.isoformat() if job.completed_at else None
|
| 372 |
-
response["output"] = job.output_data
|
| 373 |
|
| 374 |
-
#
|
| 375 |
-
|
| 376 |
-
|
| 377 |
|
| 378 |
if job.status == "failed":
|
| 379 |
response["error"] = job.error_message
|
|
|
|
| 369 |
|
| 370 |
if job.status == "completed":
|
| 371 |
response["completed_at"] = job.completed_at.isoformat() if job.completed_at else None
|
|
|
|
| 372 |
|
| 373 |
+
# Return generated prompt if available (for animation_prompt jobs)
|
| 374 |
+
if job.output_data and "prompt" in job.output_data:
|
| 375 |
+
response["prompt"] = job.output_data["prompt"]
|
| 376 |
|
| 377 |
if job.status == "failed":
|
| 378 |
response["error"] = job.error_message
|
services/gemini_job_worker.py
CHANGED
|
@@ -173,8 +173,10 @@ class GeminiJobProcessor(JobProcessor[GeminiJob]):
|
|
| 173 |
logger.info(f"Generated prompt for job {job.job_id}: {prompt}")
|
| 174 |
|
| 175 |
# Update input data with generated prompt for reference
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
| 178 |
# We need to commit this change to DB so it persists
|
| 179 |
# But session commit happens outside this method usually?
|
| 180 |
# Actually process() calls this, and process() returns job,
|
|
|
|
| 173 |
logger.info(f"Generated prompt for job {job.job_id}: {prompt}")
|
| 174 |
|
| 175 |
# Update input data with generated prompt for reference
|
| 176 |
+
# Create a new dictionary to ensure SQLAlchemy detects the change
|
| 177 |
+
new_input_data = dict(input_data)
|
| 178 |
+
new_input_data["prompt"] = prompt
|
| 179 |
+
job.input_data = new_input_data
|
| 180 |
# We need to commit this change to DB so it persists
|
| 181 |
# But session commit happens outside this method usually?
|
| 182 |
# Actually process() calls this, and process() returns job,
|