|
9 | 9 | from common.result import result |
10 | 10 | from common.utils.common import query_params_to_single_dict |
11 | 11 | from knowledge.api.problem import ProblemReadAPI, ProblemBatchCreateAPI, BatchAssociationAPI, BatchDeleteAPI, \ |
12 | | - ProblemPageAPI, ProblemDeleteAPI, ProblemEditAPI |
| 12 | + ProblemPageAPI, ProblemDeleteAPI, ProblemEditAPI, ProblemParagraphAPI |
13 | 13 | from knowledge.serializers.problem import ProblemSerializers |
14 | 14 |
|
15 | 15 |
|
@@ -53,6 +53,28 @@ def post(self, request: Request, workspace_id: str, knowledge_id: str): |
53 | 53 | data={'workspace_id': workspace_id, 'knowledge_id': knowledge_id, 'problem_list': request.data} |
54 | 54 | ).batch()) |
55 | 55 |
|
| 56 | + class Paragraph(APIView): |
| 57 | + authentication_classes = [TokenAuth] |
| 58 | + |
| 59 | + @extend_schema( |
| 60 | + summary=_('Get a list of associated paragraphs'), |
| 61 | + description=_('Get a list of associated paragraphs'), |
| 62 | + operation_id=_('Get a list of associated paragraphs'), |
| 63 | + parameters=ProblemParagraphAPI.get_parameters(), |
| 64 | + responses=ProblemParagraphAPI.get_response(), |
| 65 | + tags=[_('Knowledge Base/Documentation/Paragraph/Question')] |
| 66 | + ) |
| 67 | + @has_permissions(PermissionConstants.DOCUMENT_EDIT.get_workspace_permission()) |
| 68 | + def get(self, request: Request, workspace_id: str, knowledge_id: str, problem_id: str): |
| 69 | + return result.success(ProblemSerializers.Operate( |
| 70 | + data={ |
| 71 | + **query_params_to_single_dict(request.query_params), |
| 72 | + 'workspace_id': workspace_id, |
| 73 | + 'knowledge_id': knowledge_id, |
| 74 | + 'problem_id': problem_id |
| 75 | + } |
| 76 | + ).list_paragraph()) |
| 77 | + |
56 | 78 | class BatchAssociation(APIView): |
57 | 79 | authentication_classes = [TokenAuth] |
58 | 80 |
|
|
0 commit comments