discourse-ai/spec
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
..
configuration FEATURE: display more places where AI is used / Chat streamer (#1278) 2025-04-24 16:22:19 +10:00
db/migrate FIX: Open AI embeddings config migration & Seeded indexes cleanup & (#1092) 2025-01-27 15:24:43 -03:00
fabricators FEATURE: Add spending metrics to AI usage (#1268) 2025-04-17 15:09:48 -07:00
fixtures FEATURE: enforce jpg/png for all images (#1309) 2025-05-05 17:46:37 +10:00
jobs DEV: Use structured responses for summaries (#1252) 2025-05-06 10:09:39 -03:00
lib FIX: Retry parsing escaped inner JSON to handle control chars. (#1357) 2025-05-21 11:25:59 -03:00
models FEATURE: Examples support for personas. (#1334) 2025-05-13 10:06:16 -03:00
reports FEATURE: New sentiment analysis visualization report (#1109) 2025-02-20 09:14:10 -08:00
requests FEATURE: Examples support for personas. (#1334) 2025-05-13 10:06:16 -03:00
serializers FEATURE: Configure persona backed features in admin panel (#1245) 2025-04-10 08:16:31 -07:00
services DEV: Use structured responses for summaries (#1252) 2025-05-06 10:09:39 -03:00
shared FEATURE: Gemini Tokenizer (#1088) 2025-01-23 18:20:35 -03:00
support FEATURE: configurable embeddings (#1049) 2025-01-21 12:23:19 -03:00
system DEV: rewrites artifact spec with capybara waiters (#1347) 2025-05-20 07:27:15 +10:00
tasks DEV: Rename spec (#1344) 2025-05-16 09:40:08 +01:00
plugin_helper.rb FEATURE: Personas powered summaries. (#1232) 2025-04-02 12:54:47 -03:00
plugin_spec.rb FEATURE: smart date support for AI helper (#1044) 2024-12-31 08:04:25 +11:00