mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 19:17:56 -05:00
refac
This commit is contained in:
1 parent
5cc0ed71d6
commit
5f95008abd
33 files changed
+359
-363
No files matched your search
@@ -7,10 +7,10 @@ from copy import deepcopy
|
||||
from typing import Annotated, Any, Literal
|
||||
|
||||
from fastapi import HTTPException
|
||||
from open_webui.models.model_history import ModelHistory, ModelHistories, model_snapshot
|
||||
from open_webui.internal.db import Base, JSONField, get_async_db_context
|
||||
from open_webui.models.access_grants import AccessGrant, AccessGrantModel, AccessGrants
|
||||
from open_webui.models.groups import Groups
|
||||
from open_webui.models.model_history import ModelHistories, ModelHistory, model_snapshot
|
||||
from open_webui.models.users import User, UserModel, UserResponse, Users
|
||||
from open_webui.utils.misc import json_text_variants
|
||||
from open_webui.utils.validate import validate_image_url
|
||||
@@ -280,6 +280,7 @@ class ModelsTable:
|
||||
**data, user_id=user_id, version_id=entry.id, created_at=int(time.time()), updated_at=int(time.time())
|
||||
)
|
||||
session.add_all([current, entry])
|
||||
await AccessGrants.replace_access_grants(session, 'model', form.id, form.access_grants)
|
||||
else:
|
||||
if production_version_id is not None:
|
||||
# Serialize with history deletion before reading the selected snapshot.
|
||||
@@ -322,8 +323,6 @@ class ModelsTable:
|
||||
)
|
||||
if result.rowcount != 1:
|
||||
raise HTTPException(409, {'code': 'version_conflict'})
|
||||
if form.access_grants is not None or current in session.new:
|
||||
await AccessGrants.replace_access_grants(session, 'model', form.id, form.access_grants)
|
||||
return current
|
||||
|
||||
async def _written_model(self, session, model):
|
||||
|
||||
Reference in new issue
Block a user