|
|
|
|
@ -122,7 +122,7 @@ class DatasetDocumentSegmentListApi(Resource):
|
|
|
|
|
segment_ids = request.args.getlist("segment_id")
|
|
|
|
|
|
|
|
|
|
# The role of the current user in the ta table must be admin or owner
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
@ -149,7 +149,7 @@ class DatasetDocumentSegmentApi(Resource):
|
|
|
|
|
# check user's model setting
|
|
|
|
|
DatasetService.check_dataset_model_setting(dataset)
|
|
|
|
|
# The role of the current user in the ta table must be admin, owner, or editor
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
@ -202,7 +202,7 @@ class DatasetDocumentSegmentAddApi(Resource):
|
|
|
|
|
document = DocumentService.get_document(dataset_id, document_id)
|
|
|
|
|
if not document:
|
|
|
|
|
raise NotFound("Document not found.")
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
# check embedding model setting
|
|
|
|
|
if dataset.indexing_technique == "high_quality":
|
|
|
|
|
@ -277,7 +277,7 @@ class DatasetDocumentSegmentUpdateApi(Resource):
|
|
|
|
|
if not segment:
|
|
|
|
|
raise NotFound("Segment not found.")
|
|
|
|
|
# The role of the current user in the ta table must be admin, owner, or editor
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
@ -320,7 +320,7 @@ class DatasetDocumentSegmentUpdateApi(Resource):
|
|
|
|
|
if not segment:
|
|
|
|
|
raise NotFound("Segment not found.")
|
|
|
|
|
# The role of the current user in the ta table must be admin or owner
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
@ -420,7 +420,7 @@ class ChildChunkAddApi(Resource):
|
|
|
|
|
).first()
|
|
|
|
|
if not segment:
|
|
|
|
|
raise NotFound("Segment not found.")
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
# check embedding model setting
|
|
|
|
|
if dataset.indexing_technique == "high_quality":
|
|
|
|
|
@ -520,7 +520,7 @@ class ChildChunkAddApi(Resource):
|
|
|
|
|
if not segment:
|
|
|
|
|
raise NotFound("Segment not found.")
|
|
|
|
|
# The role of the current user in the ta table must be admin, owner, or editor
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
@ -570,7 +570,7 @@ class ChildChunkUpdateApi(Resource):
|
|
|
|
|
if not child_chunk:
|
|
|
|
|
raise NotFound("Child chunk not found.")
|
|
|
|
|
# The role of the current user in the ta table must be admin or owner
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
@ -614,7 +614,7 @@ class ChildChunkUpdateApi(Resource):
|
|
|
|
|
if not child_chunk:
|
|
|
|
|
raise NotFound("Child chunk not found.")
|
|
|
|
|
# The role of the current user in the ta table must be admin or owner
|
|
|
|
|
if not current_user.is_editor:
|
|
|
|
|
if not current_user.is_dataset_editor:
|
|
|
|
|
raise Forbidden()
|
|
|
|
|
try:
|
|
|
|
|
DatasetService.check_dataset_permission(dataset, current_user)
|
|
|
|
|
|