Skip to content

Conversation

@AntoLC
Copy link
Collaborator

@AntoLC AntoLC commented Dec 11, 2024

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.

@AntoLC AntoLC added bug Something isn't working backend labels Dec 11, 2024
@AntoLC AntoLC self-assigned this Dec 11, 2024
@AntoLC AntoLC force-pushed the fix/ia-prob-sanitize branch 2 times, most recently from a3d4b3b to d87560e Compare December 11, 2024 12:07
Comment on lines 69 to 68
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)
Copy link
Contributor

@lebaudantoine lebaudantoine Dec 11, 2024

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

Copy link
Collaborator Author

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
Copy link
Contributor

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

Copy link
Collaborator Author

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.

@AntoLC AntoLC force-pushed the fix/ia-prob-sanitize branch 3 times, most recently from 282ceab to 31dce82 Compare December 11, 2024 12:57
@AntoLC AntoLC requested a review from lebaudantoine December 11, 2024 13:00
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.
@AntoLC AntoLC force-pushed the fix/ia-prob-sanitize branch from 31dce82 to 0f54d94 Compare December 11, 2024 13:56
@AntoLC AntoLC merged commit ed90769 into main Dec 11, 2024
15 of 16 checks passed
@AntoLC AntoLC deleted the fix/ia-prob-sanitize branch December 11, 2024 14:21
@AntoLC AntoLC mentioned this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants