-
Notifications
You must be signed in to change notification settings - Fork 416
🐛(backend) fix sanitize problem IA #490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a3d4b3b to
d87560e
Compare
| content = response.choices[0].message.content | ||
| sanitized_content = re.sub(r"(?<!\\)\n", "\\\\n", content) | ||
| sanitized_content = re.sub(r"(?<!\\)\t", "\\\\t", sanitized_content) | ||
|
|
||
| json_response = json.loads(sanitized_content) | ||
| json_response = json.loads(response.choices[0].message.content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the fix is functional and solves the problem effectively, it seems reasonable to move forward without additional complexity.
However, we could enhance the implementation further with a try except, ignore if the sanitization fails and fallback on the json.loads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes better to do that.
|
|
||
| ## Fixed | ||
|
|
||
| - 🐛(frontend) Fix hidden menu on Firefox #468 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is wrongly committed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its ok, I don't want to make a commit for that.
282ceab to
31dce82
Compare
Albert send us back a malformed IA json, the sanitize function was not able to handle it correctly. We add a try catch on it, to not use the sanitizer if the json.loads fails.
31dce82 to
0f54d94
Compare
Purpose
Albert send us back a malformed IA json, the sanitize function was not able to handle it correctly.
Proposal
We will handle the sanitize failure with a try catch.