discourse-ai/spec/lib
Roman Rizzi d72ad84f8f
FIX: Retry parsing escaped inner JSON to handle control chars. (#1357)
The structured output JSON comes embedded inside the API response, which is also a JSON. Since we have to parse the response to process it, any control characters inside the structured output are unescaped into regular characters, leading to invalid JSON and breaking during parsing. This change adds a retry mechanism that escapes
the string again if parsing fails, preventing the parser from breaking on malformed input and working around this issue.

For example:

```
  original = '{ "a": "{\\"key\\":\\"value with \\n newline\\"}" }'
  JSON.parse(original) => { "a" => "{\"key\":\"value with \n newline\"}" }
  # At this point, the inner JSON string contains an actual newline.
```
2025-05-21 11:25:59 -03:00
..
completions FIX: Retry parsing escaped inner JSON to handle control chars. (#1357) 2025-05-21 11:25:59 -03:00
discord/bot REFACTOR: Move personas into its own module. (#1233) 2025-03-31 14:42:33 -03:00
discourse_automation FIX: persona triage should be logged to automation (#1326) 2025-05-08 12:51:36 +10:00
inference FEATURE: configurable embeddings (#1049) 2025-01-21 12:23:19 -03:00
modules FEATURE: Triage can hide posts after adding them to the review queue (#1348) 2025-05-20 08:19:00 +10:00
personas FEATURE: allow researcher to also research specific topics (#1339) 2025-05-15 17:48:21 +10:00
utils DEV: Improve diff streaming accuracy with safety checker (#1338) 2025-05-15 11:38:46 -07:00
guardian_extensions_spec.rb FIX: Restore gists previous group access behavior. (#1247) 2025-04-07 12:04:30 -03:00