Skip to content

Commit

Permalink
Merge pull request #302 from DieterHolvoet/issue/264
Browse files Browse the repository at this point in the history
Fix unescaped backslashes in JSON produced by GPT
  • Loading branch information
freekmurze authored Oct 18, 2023
2 parents 5237e4d + c8fd6b8 commit 3d886de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Solutions/OpenAi/OpenAiSolutionResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function links(): array
$textLinks = explode(PHP_EOL, $textLinks);

$textLinks = array_map(function ($textLink) {
$textLink = str_replace('\\', '\\\\', $textLink);
$textLink = str_replace('\\\\\\', '\\\\', $textLink);

return json_decode($textLink, true);
}, $textLinks);

Expand Down

0 comments on commit 3d886de

Please sign in to comment.