chore: snapshot before HartOMat rebrand

This commit is contained in:
2026-04-06 12:41:44 +02:00
parent 7d27ffc116
commit fa7093307a
25 changed files with 247 additions and 92 deletions
+11 -2
View File
@@ -99,12 +99,21 @@ async def send_message(
raise HTTPException(status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, detail=str(exc))
except Exception as exc:
error_msg = str(exc)
error_code = None
# Extract meaningful error from OpenAI exceptions
if hasattr(exc, 'message'):
error_msg = exc.message
elif hasattr(exc, 'body') and isinstance(exc.body, dict):
error_msg = exc.body.get('error', {}).get('message', error_msg)
if hasattr(exc, 'body') and isinstance(exc.body, dict):
err = exc.body.get('error', {})
error_code = err.get('code')
error_msg = err.get('message', error_msg)
logger.error("Chat error: %s", error_msg)
# Content filter violation → return 422 with user-friendly message
if error_code == 'content_filter':
raise HTTPException(
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
detail="Deine Nachricht wurde vom Azure Content Filter blockiert. Bitte formuliere sie um.",
)
raise HTTPException(status_code=500, detail=f"AI error: {error_msg[:500]}")
except Exception as exc:
logger.exception("Chat error for user %s", user.id)
+44
View File
@@ -212,6 +212,50 @@ async def stream_render_log(
from fastapi import status as http_status
@router.post("/activity/dismiss-failed", status_code=http_status.HTTP_200_OK)
async def dismiss_all_failed(
user: User = Depends(require_admin_or_pm),
db: AsyncSession = Depends(get_db),
):
"""Reset all failed render jobs and CAD files so they stop showing as failures."""
from sqlalchemy import update as sql_update
render_result = await db.execute(
sql_update(OrderLine)
.where(OrderLine.render_status == "failed")
.values(render_status="cancelled")
)
cad_result = await db.execute(
sql_update(CadFile)
.where(CadFile.processing_status == ProcessingStatus.failed)
.values(processing_status=ProcessingStatus.pending)
)
await db.commit()
return {"dismissed_renders": render_result.rowcount, "dismissed_cad": cad_result.rowcount}
@router.post("/activity/dismiss-render/{order_line_id}", status_code=http_status.HTTP_200_OK)
async def dismiss_single_failed_render(
order_line_id: str,
user: User = Depends(require_admin_or_pm),
db: AsyncSession = Depends(get_db),
):
"""Dismiss a single failed render job by setting its status to 'cancelled'."""
result = await db.execute(
select(OrderLine).where(
OrderLine.id == order_line_id,
OrderLine.render_status == "failed",
)
)
line = result.scalar_one_or_none()
if not line:
raise HTTPException(404, detail="Failed render job not found")
line.render_status = "cancelled"
await db.commit()
return {"dismissed": order_line_id}
@router.post("/activity/{cad_file_id}/reprocess", status_code=http_status.HTTP_202_ACCEPTED)
async def reprocess_cad_file(
cad_file_id: str,
@@ -443,8 +443,9 @@ def render_order_line_task(self, order_line_id: str):
if is_cinematic:
# ── Cinematic highlight animation path ──────────────────────
_cine_fps = 24
_cine_frames = 480
# Use frame_count/fps from output_type.render_settings (already extracted above)
_cine_fps = fps # extracted from render_settings, default 25
_cine_frames = frame_count # extracted from render_settings, default 24
emit(order_line_id, f"Starting cinematic render: {_cine_frames} frames @ {_cine_fps}fps, {render_width or 1920}x{render_height or 1080}{tmpl_info}")
pl.step_start("blender_cinematic", {"frame_count": _cine_frames, "fps": _cine_fps})
from app.services.render_blender import is_blender_available, render_cinematic_to_file