fix: RAG vector search SQL syntax error breaking assistant chat
- Use CAST(:embedding AS vector) instead of :embedding::vector to avoid SQLAlchemy named param conflict with PostgreSQL :: cast syntax - Add db.rollback() before recording AI usage on failure to prevent InFailedSQLTransactionError cascade Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,7 @@ async def post_message(
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=str(e))
|
||||
except Exception as e:
|
||||
logger.exception("Assistant chat message failed: %s", e)
|
||||
await db.rollback()
|
||||
await record_ai_usage(
|
||||
user_id=current_user.id,
|
||||
account_id=current_user.account_id,
|
||||
|
||||
Reference in New Issue
Block a user