Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/application/views/application_chat_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ApplicationChatRecordAddKnowledge(APIView):
CompareConstants.AND),
RoleConstants.WORKSPACE_MANAGE.get_workspace_role())
def post(self, request: Request, workspace_id: str, application_id: str):
return result.success(ApplicationChatRecordAddKnowledgeSerializer().post_improve(
return result.success(ApplicationChatRecordAddKnowledgeSerializer(data = {'workspace_id': workspace_id, 'application_id': application_id, **request.data}).post_improve(
{'workspace_id': workspace_id, 'application_id': application_id, **request.data}, request=request))


Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code has a few improvements. The existing post method is called on an instance of ApplicationChatRecordAddKnowledgeSerializer, which does not appear to be defined in the provided context. Assuming you want to handle POST request data directly, consider updating the serializer instantiation and passing it the combined dictionary from **request.data and {'workspace_id': workspace_id, 'application_id': application_id}. Also, using f-strings instead of string concatenation can make the code cleaner:

def post(self, request: Request, workspace_id: str, application_id: str) -> Response:
    data = {'workspace_id': workspace_id, 'application_id': application_id, **request.data}
    return result.success(
        ApplicationChatRecordAddKnowledgeSerializer(data=data).post_improve(request=request)
    )

This version avoids calling a non-existent method and uses modern Python features such as f-strings for formatting. Make sure that result.success() and ApplicationChatRecordAddKnowledgeSerializer.post_improve are correctly implemented elsewhere in your codebase.

Expand Down
Loading