diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index f99034a3c5..33de43b84f 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1141,6 +1141,12 @@ DEFAULT_MODELS = PersistentConfig( "DEFAULT_MODELS", "ui.default_models", os.environ.get("DEFAULT_MODELS", None) ) +DEFAULT_PINNED_MODELS = PersistentConfig( + "DEFAULT_PINNED_MODELS", + "ui.default_pinned_models", + os.environ.get("DEFAULT_PINNED_MODELS", None), +) + try: default_prompt_suggestions = json.loads( os.environ.get("DEFAULT_PROMPT_SUGGESTIONS", "[]") diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index cd54dd25fc..e21dd5d1ed 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -373,6 +373,7 @@ from open_webui.config import ( PENDING_USER_OVERLAY_TITLE, DEFAULT_PROMPT_SUGGESTIONS, DEFAULT_MODELS, + DEFAULT_PINNED_MODELS, DEFAULT_ARENA_MODEL, MODEL_ORDER_LIST, EVALUATION_ARENA_MODELS, @@ -754,6 +755,10 @@ app.state.config.ADMIN_EMAIL = ADMIN_EMAIL app.state.config.DEFAULT_MODELS = DEFAULT_MODELS +app.state.config.DEFAULT_PINNED_MODELS = DEFAULT_PINNED_MODELS +app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST + + app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE @@ -765,7 +770,6 @@ app.state.config.RESPONSE_WATERMARK = RESPONSE_WATERMARK app.state.config.USER_PERMISSIONS = USER_PERMISSIONS app.state.config.WEBHOOK_URL = WEBHOOK_URL app.state.config.BANNERS = WEBUI_BANNERS -app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST app.state.config.ENABLE_CHANNELS = ENABLE_CHANNELS @@ -1877,6 +1881,7 @@ async def get_app_config(request: Request): **( { "default_models": app.state.config.DEFAULT_MODELS, + "default_pinned_models": app.state.config.DEFAULT_PINNED_MODELS, "default_prompt_suggestions": app.state.config.DEFAULT_PROMPT_SUGGESTIONS, "user_count": user_count, "code": { diff --git a/backend/open_webui/routers/configs.py b/backend/open_webui/routers/configs.py index 0e88b7a929..0eb88e767e 100644 --- a/backend/open_webui/routers/configs.py +++ b/backend/open_webui/routers/configs.py @@ -463,6 +463,7 @@ async def set_code_execution_config( ############################ class ModelsConfigForm(BaseModel): DEFAULT_MODELS: Optional[str] + DEFAULT_PINNED_MODELS: Optional[str] MODEL_ORDER_LIST: Optional[list[str]] @@ -470,6 +471,7 @@ class ModelsConfigForm(BaseModel): async def get_models_config(request: Request, user=Depends(get_admin_user)): return { "DEFAULT_MODELS": request.app.state.config.DEFAULT_MODELS, + "DEFAULT_PINNED_MODELS": request.app.state.config.DEFAULT_PINNED_MODELS, "MODEL_ORDER_LIST": request.app.state.config.MODEL_ORDER_LIST, } @@ -479,9 +481,11 @@ async def set_models_config( request: Request, form_data: ModelsConfigForm, user=Depends(get_admin_user) ): request.app.state.config.DEFAULT_MODELS = form_data.DEFAULT_MODELS + request.app.state.config.DEFAULT_PINNED_MODELS = form_data.DEFAULT_PINNED_MODELS request.app.state.config.MODEL_ORDER_LIST = form_data.MODEL_ORDER_LIST return { "DEFAULT_MODELS": request.app.state.config.DEFAULT_MODELS, + "DEFAULT_PINNED_MODELS": request.app.state.config.DEFAULT_PINNED_MODELS, "MODEL_ORDER_LIST": request.app.state.config.MODEL_ORDER_LIST, } diff --git a/src/lib/components/admin/Settings/Models.svelte b/src/lib/components/admin/Settings/Models.svelte index 0200ed2e68..2f559905fc 100644 --- a/src/lib/components/admin/Settings/Models.svelte +++ b/src/lib/components/admin/Settings/Models.svelte @@ -250,9 +250,8 @@ {#if selectedModelId === null}