|
7 | 7 |
|
8 | 8 | import uuid_utils.compat as uuid |
9 | 9 | from common.config.embedding_config import ModelManage |
10 | | -from common.constants.cache_version import Cache_Version |
11 | | -from common.constants.resource_permission_constants import ResourceAuthType |
12 | 10 | from common.database_model_manage.database_model_manage import DatabaseModelManage |
13 | 11 | from common.db.search import native_search |
14 | 12 | from common.exception.app_exception import AppApiException |
15 | 13 | from common.utils.common import get_file_content |
16 | 14 | from common.utils.rsa_util import rsa_long_decrypt, rsa_long_encrypt |
17 | | -from django.core.cache import cache |
18 | 15 | from django.db import transaction |
19 | 16 | from django.db.models import QuerySet |
20 | 17 | from django.utils.translation import gettext_lazy as _ |
@@ -207,9 +204,12 @@ def delete(self, with_valid=True): |
207 | 204 |
|
208 | 205 | def edit(self, instance: Dict, user_id: str, with_valid=True): |
209 | 206 | if with_valid: |
210 | | - self.is_valid(raise_exception=True) |
211 | | - model = QuerySet(Model).filter(id=self.data.get("id"), workspace_id=self.data.get("workspace_id")).first() |
212 | | - |
| 207 | + super().is_valid(raise_exception=True) |
| 208 | + model = ( |
| 209 | + QuerySet(Model) |
| 210 | + .filter(id=self.data.get("id"), workspace_id=self.data.get("workspace_id", "None")) |
| 211 | + .first() |
| 212 | + ) |
213 | 213 | credential, model_credential, provider_handler = ModelSerializer.Edit(data={**instance}).is_valid( |
214 | 214 | model=model |
215 | 215 | ) |
|
0 commit comments