mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-29 06:32:52 +00:00
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:
parent
f8ab360856
commit
c901bc39d3
1 changed files with 4 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue