Skip to content
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

Enhanced JSON String Escaping for OpenAI Payload #86

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

ajinkyac03
Copy link
Member

@ajinkyac03 ajinkyac03 commented Aug 31, 2023

Summary by CodeRabbit

  • Bug Fix: Enhanced the escapeForJson method in GetCrmActionSuggestions.java to handle a wider range of special characters and control characters. This will ensure that JSON strings are properly escaped, preventing potential parsing errors.
  • Chore: Improved error logging in OpenAiRequest.java. Now, when a request to the OpenAI API fails, the response body of the exception is logged. This will aid in debugging and issue resolution.

@coderabbitai
Copy link

coderabbitai bot commented Aug 31, 2023

Walkthrough

The changes introduced in this pull request focus on enhancing the JSON string escaping mechanism and improving error logging when making requests to the OpenAI API. The updates ensure better data handling, increased security, and improved debugging capabilities.

Changes

File Summary
.../api/lib/GetCrmActionSuggestions.java Introduced a comprehensive JSON string escaping mechanism that handles backslashes, double quotes, newlines, carriage returns, tabs, backspaces, form feeds, and control characters.
.../api/lib/openAi/OpenAiRequest.java Enhanced error logging by including the response body of exceptions when making requests to the OpenAI API.

🐇💻

"In the land of code where the shadows lie,

We escape and log, under the clouded sky.

With each pull request, we make our stand,

Crafting software with a careful hand.

So here's to changes, big and small,

In the end, they matter to us all." 🎉🥕


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance. The bot stays silent unless called upon.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between d22f057 and fdcf51a commits.
Files selected for processing (2)
  • src/main/java/com/salessparrow/api/lib/GetCrmActionSuggestions.java (2 hunks)
  • src/main/java/com/salessparrow/api/lib/openAi/OpenAiRequest.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/main/java/com/salessparrow/api/lib/openAi/OpenAiRequest.java

Copy link
Member

@AMAN-BARBARIA AMAN-BARBARIA left a comment

Choose a reason for hiding this comment

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

LGTM

@AMAN-BARBARIA AMAN-BARBARIA merged commit cd5e70e into milestone/v0.2.0 Aug 31, 2023
@AMAN-BARBARIA AMAN-BARBARIA deleted the escape_character_fix branch August 31, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants