fix: embeddings API fails for connections with a Prefix ID (#32724)

Calling the embeddings API with a model from a connection that has a Prefix ID sent the prefixed model name to the provider, which rejected it as an unknown model. The prefix is now removed before the request goes out, the same way chat requests already do it, so every model on such a connection works through the embeddings API again.

Fixes #32715
This commit is contained in:
Classic298 2026-10-20 19:01:29 +02:00 • committed by GitHub
parent f8ab360856
commit c901bc39d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1695,8 +1695,6 @@ async def embeddings(request: Request, form_data: dict, user):
dict: OpenAI-compatible embeddings response.
"""
idx = 0
# Prepare payload/body
body = JSONCodec.dumps(form_data)
# Find correct backend url/key based on model
model_id = form_data.get('model')
# Check if model is already in app state cache to avoid expensive get_all_models() call
@ -1709,6 +1707,10 @@ async def embeddings(request: Request, form_data: dict, user):
url, key, api_config = await get_openai_connection(idx)
form_data['model'] = strip_provider_model_prefix(form_data['model'], api_config.get('prefix_id'))
# Prepare payload/body
body = JSONCodec.dumps(form_data)
r = None
streaming = False