perf: Handle abnormal response#5163
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 |
| def append_chat_record(self, chat_record: ChatRecord): | ||
| chat_record.problem_text = chat_record.problem_text[0:10240] if chat_record.problem_text is not None else "" | ||
| chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.problem_text is not None else "" | ||
| chat_record.answer_text = chat_record.answer_text[0:40960] if chat_record.answer_text is not None else "" |
There was a problem hiding this comment.
顺便修复:这里是变量名写错了
| if not enableException: | ||
| chunk = self.base_to_response.to_stream_chunk_response(self.params.get('chat_id'), | ||
| self.params.get('chat_id'), | ||
| self.params.get('chat_record_id'), |
There was a problem hiding this comment.
顺便修复:这里也取错属性了。
| self.context['details'] = details.get('details') | ||
| self.extra['input_field_list'] = details.get('input_field_list') | ||
| self.extra['output_field_list'] = details.get('input_field_list') | ||
| self.extra['output_field_list'] = details.get('output_field_list') |
There was a problem hiding this comment.
顺便修复:取错属性了
| if not is_valid_uuid(chat_record_id): | ||
| raise ChatException(500, _("Conversation record does not exist")) | ||
| else: | ||
| return chat_record |
There was a problem hiding this comment.
顺便优化:不为空时,直接return,避免下面再查询。
What this PR does / why we need it?
perf: Handle abnormal responses
Summary of your change
处理异常响应
Please indicate you've done the following: