Просмотр исходного кода

feat: add NotFound error for dataset service (#9215)

tags/0.9.2
crazywoola 1 год назад
Родитель
Сommit
e0c8189f1a
Аккаунт пользователя с таким Email не найден
1 измененных файлов: 3 добавлений и 0 удалений
  1. 3
    0
      api/services/dataset_service.py

+ 3
- 0
api/services/dataset_service.py Просмотреть файл

@@ -8,6 +8,7 @@ from typing import Optional

from flask_login import current_user
from sqlalchemy import func
from werkzeug.exceptions import NotFound

from configs import dify_config
from core.errors.error import LLMBadRequestError, ProviderTokenNotInitError
@@ -975,6 +976,8 @@ class DocumentService:
):
DatasetService.check_dataset_model_setting(dataset)
document = DocumentService.get_document(dataset.id, document_data["original_document_id"])
if document is None:
raise NotFound("Document not found")
if document.display_status != "available":
raise ValueError("Document is not available")
# update document name

Загрузка…
Отмена
Сохранить