fix: Chat log add to knowledge error#4135
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| 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)) | ||
|
|
||
|
|
There was a problem hiding this comment.
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.
fix: Chat log add to knowledge error