Spaces:
Running
Running
Fix catalog: use insert_image with correct params, store prompt info in job
Browse files
src/content_engine/api/routes_pod.py
CHANGED
|
@@ -650,7 +650,14 @@ async def generate_on_pod(request: PodGenerateRequest):
|
|
| 650 |
"prompt_id": prompt_id,
|
| 651 |
"status": "running",
|
| 652 |
"seed": seed,
|
|
|
|
| 653 |
"started_at": time.time(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
}
|
| 655 |
|
| 656 |
logger.info("Pod generation started: %s -> %s", job_id, prompt_id)
|
|
@@ -742,12 +749,22 @@ async def _poll_pod_job(job_id: str, prompt_id: str, content_rating: str):
|
|
| 742 |
try:
|
| 743 |
from content_engine.services.catalog import CatalogService
|
| 744 |
catalog = CatalogService()
|
| 745 |
-
|
| 746 |
-
|
|
|
|
|
|
|
| 747 |
content_rating=content_rating,
|
| 748 |
-
|
| 749 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 750 |
)
|
|
|
|
| 751 |
except Exception as e:
|
| 752 |
logger.warning("Failed to catalog pod image: %s", e)
|
| 753 |
|
|
|
|
| 650 |
"prompt_id": prompt_id,
|
| 651 |
"status": "running",
|
| 652 |
"seed": seed,
|
| 653 |
+
"created_at": time.time(),
|
| 654 |
"started_at": time.time(),
|
| 655 |
+
"positive_prompt": request.positive_prompt,
|
| 656 |
+
"negative_prompt": request.negative_prompt,
|
| 657 |
+
"steps": request.steps,
|
| 658 |
+
"cfg": request.cfg,
|
| 659 |
+
"width": request.width,
|
| 660 |
+
"height": request.height,
|
| 661 |
}
|
| 662 |
|
| 663 |
logger.info("Pod generation started: %s -> %s", job_id, prompt_id)
|
|
|
|
| 749 |
try:
|
| 750 |
from content_engine.services.catalog import CatalogService
|
| 751 |
catalog = CatalogService()
|
| 752 |
+
job_info = _pod_jobs[job_id]
|
| 753 |
+
await catalog.insert_image(
|
| 754 |
+
file_path=str(local_path),
|
| 755 |
+
image_bytes=img_resp.content,
|
| 756 |
content_rating=content_rating,
|
| 757 |
+
positive_prompt=job_info.get("positive_prompt"),
|
| 758 |
+
negative_prompt=job_info.get("negative_prompt"),
|
| 759 |
+
seed=job_info.get("seed"),
|
| 760 |
+
steps=job_info.get("steps"),
|
| 761 |
+
cfg=job_info.get("cfg"),
|
| 762 |
+
width=job_info.get("width"),
|
| 763 |
+
height=job_info.get("height"),
|
| 764 |
+
generation_backend="runpod-pod",
|
| 765 |
+
generation_time_seconds=time.time() - job_info.get("created_at", time.time()),
|
| 766 |
)
|
| 767 |
+
logger.info("Pod image cataloged: %s", job_id)
|
| 768 |
except Exception as e:
|
| 769 |
logger.warning("Failed to catalog pod image: %s", e)
|
| 770 |
|