mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-28 15:45:22 -04:00
fix(ai): offload model resolution from async paths
Wrap blocking _resolve_model calls in asyncio.to_thread across async model interaction paths so endpoint/model resolution does not stall the event loop. Preserve owner-scoped resolution and add focused regression coverage.
This commit is contained in:
@@ -25,9 +25,10 @@ def test_model_listing_and_image_fallback_are_owner_scoped():
|
||||
|
||||
assert "owner: Optional[str] = None" in list_body
|
||||
assert "owner_filter(query, ModelEndpoint, owner)" in list_body
|
||||
assert "_resolve_model(candidate, owner=owner)" in image_body
|
||||
# _resolve_model is offloaded to a worker thread (#4589) but stays owner-scoped.
|
||||
assert "asyncio.to_thread(_resolve_model, candidate, owner=owner)" in image_body
|
||||
assert "owner_filter(_img_q, ModelEndpoint, owner)" in image_body
|
||||
assert "_resolve_model(model_spec, owner=owner)" in image_body
|
||||
assert "asyncio.to_thread(_resolve_model, model_spec, owner=owner)" in image_body
|
||||
|
||||
|
||||
# chat_with_model, list_models and ask_teacher moved to the registry (#3629)
|
||||
|
||||
Reference in New Issue
Block a user