0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/plugins/discourse-ai/lib/ai_helper
Rafael dos Santos Silva 2f5c074d66
FIX: AI helper title suggestions erroring on partially streamed JSON arrays (#42442)
Previously, `AiHelper::Assistant` assembled list-type results from
partial structured-output notifications, so backends that stream a JSON
array across many small deltas (e.g. a title's closing `",` and the
following whitespace as separate chunks) left a transient `nil`
placeholder in the suggestions, raising `NoMethodError: undefined method
'gsub' for nil` on every title suggestion request.

This change reads array results once from the completed structured
output after the reply finishes (streaming accumulation is kept only for
string schemas, which are the ones actually streamed to clients), and
compacts the `TitlesGenerator` example and system prompt JSON so the
model stops mimicking pretty-printed whitespace — saving roughly a third
of the completion tokens per request.
2026-08-07 14:40:18 -03:00
..
assistant.rb FIX: AI helper title suggestions erroring on partially streamed JSON arrays (#42442) 2026-08-07 14:40:18 -03:00
chat_thread_titler.rb DEV: AI persona to agent migration (#38319) 2026-03-10 15:59:45 +11:00
date_formatter.rb
entry_point.rb DEV: Enable Rails/FilePath rubocop rule (#40097) 2026-05-19 19:07:54 +02:00
semantic_categorizer.rb FIX: Respect category tag restrictions when suggesting tags (#40545) 2026-06-04 09:11:56 +02:00