mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-14 23:22:44 +00:00
Merge 95667c2e47 into ca8f151a12
This commit is contained in:
commit
1234205130
1 changed files with 7 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ log = logging.getLogger(__name__)
|
|||
_STRIP_PROXY_HEADERS = frozenset({'content-encoding', 'content-length', 'transfer-encoding', 'server', 'date'})
|
||||
_MODEL_LIST_TIMEOUT = aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST)
|
||||
_UNSUPPORTED_OPENAI_MODEL_KEYWORDS = ('babbage', 'dall-e', 'davinci', 'embedding', 'tts', 'whisper')
|
||||
_STRIP_MODEL_KEYS = frozenset({'action_ids', 'arena', 'filter_ids', 'info', 'pipe', 'preset'})
|
||||
BASE_MODELS_CACHE_KEY = f'{REDIS_KEY_PREFIX}:models:base'
|
||||
|
||||
|
||||
|
|
@ -86,6 +87,11 @@ def _clean_proxy_headers(raw_headers) -> dict:
|
|||
return {k: v for k, v in raw_headers.items() if k.lower() not in _STRIP_PROXY_HEADERS}
|
||||
|
||||
|
||||
def _clean_model_keys(model: dict) -> dict:
|
||||
"""Return a copy of *model* without the keys Open WebUI assigns itself."""
|
||||
return {k: v for k, v in model.items() if k not in _STRIP_MODEL_KEYS}
|
||||
|
||||
|
||||
async def send_get_request(
|
||||
request: Request = None,
|
||||
url=None,
|
||||
|
|
@ -833,7 +839,7 @@ async def get_all_models(request: Request, user: UserModel) -> dict[str, list]:
|
|||
if model_id and model_id not in models:
|
||||
provider = model.get('provider', '')
|
||||
merged = {
|
||||
**model,
|
||||
**_clean_model_keys(model),
|
||||
'name': model.get('name', model_id),
|
||||
'owned_by': 'openai',
|
||||
'openai': model,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue