mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
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. |
||
|---|---|---|
| .. | ||
| assistant.rb | ||
| chat_thread_titler.rb | ||
| date_formatter.rb | ||
| entry_point.rb | ||
| semantic_categorizer.rb | ||