Skip to content

fix(api): correct tenant_id UUID handling in two list endpoints - #951

Open
renjialin123 wants to merge 1 commit into
dataelement:mainfrom
renjialin123:fix/tenant-id-uuid-handling
Open

fix(api): correct tenant_id UUID handling in two list endpoints#951
renjialin123 wants to merge 1 commit into
dataelement:mainfrom
renjialin123:fix/tenant-id-uuid-handling

Conversation

@renjialin123

Copy link
Copy Markdown

Summary## Summary

GET /api/enterprise/llm-models returns HTTP 500 on upstream main even with a valid tenant and row in the DB.

Root cause: backend/app/api/enterprise.py:401 wraps the path parameter tid (already typed uuid.UUID, so FastAPI has already converted it) with uuid.UUID() again:

query = query.where(LLMModel.tenant_id == uuid.UUID(tid))   # ❌
# AttributeError: 'UUID' object has no attribute 'replace'
Fix (single line):

python
query = query.where(LLMModel.tenant_id == tid)             # ✅
No migration, no new dependency, no behaviour change for valid inputs. Independent of the db: Any = None regression (#841, being fixed by #847).

## Checklist

- [ ] Tested locally
- [ ] No unrelated changes included

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant