feat: model sync endpoint

This commit is contained in:
Timothy Jaeryang Baek
2025-07-28 13:06:05 +04:00
parent 49a6211d36
commit c1e4139e5c
2 changed files with 62 additions and 0 deletions
+18
View File
@@ -7,6 +7,8 @@ from open_webui.models.models import (
ModelUserResponse,
Models,
)
from pydantic import BaseModel
from open_webui.constants import ERROR_MESSAGES
from fastapi import APIRouter, Depends, HTTPException, Request, status
@@ -78,6 +80,22 @@ async def create_new_model(
)
############################
# SyncModels
############################
class SyncModelsForm(BaseModel):
models: list[ModelModel] = []
@router.post("/sync", response_model=list[ModelModel])
async def sync_models(
request: Request, form_data: SyncModelsForm, user=Depends(get_admin_user)
):
return Models.sync_models(user.id, form_data.models)
###########################
# GetModelById
###########################