Skip to content

Commit 945b3b4

Browse files
authored
πŸ› fix Multimodal duplicated added
2 parents 0187551 + 2116bb2 commit 945b3b4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

β€Žbackend/services/model_management_service.pyβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ async def create_model_for_tenant(user_id: str, tenant_id: str, model_data: Dict
8989
create_model_record(embedding_data, user_id, tenant_id)
9090
logging.debug(
9191
f"Embedding model {embedding_data['display_name']} created successfully")
92-
93-
# Non-multimodal
94-
create_model_record(model_data, user_id, tenant_id)
95-
logging.debug(
96-
f"Model {model_data['display_name']} created successfully")
92+
else:
93+
# Non-multimodal
94+
create_model_record(model_data, user_id, tenant_id)
95+
logging.debug(
96+
f"Model {model_data['display_name']} created successfully")
9797
except Exception as e:
9898
logging.error(f"Failed to create model: {str(e)}")
9999
raise Exception(f"Failed to create model: {str(e)}")

β€Žtest/backend/services/test_model_management_service.pyβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ async def test_create_model_for_tenant_conflict_raises():
329329

330330

331331
@pytest.mark.asyncio
332-
async def test_create_model_for_tenant_multi_embedding_creates_three_records():
332+
async def test_create_model_for_tenant_multi_embedding_creates_two_records():
333333
svc = import_svc()
334334

335335
with mock.patch.object(svc, "get_model_by_display_name", return_value=None), \
@@ -346,8 +346,8 @@ async def test_create_model_for_tenant_multi_embedding_creates_three_records():
346346
}
347347

348348
await svc.create_model_for_tenant(user_id, tenant_id, model_data)
349-
# Per current implementation, it creates multi_embedding, embedding variant, and then one more general create
350-
assert mock_create.call_count == 3
349+
# Should create two records: multi_embedding and its embedding variant
350+
assert mock_create.call_count == 2
351351

352352

353353
@pytest.mark.asyncio

0 commit comments

Comments
Β (0)