main ← fix/ai-helper-title-suggestions-non-list
merged 03:54PM - 16 Oct 26 UTC
Previously, title suggestions called `flatten` on whatever `generate_prompt` ret…urned, assuming an Array. The shape actually depends on the agent picked in `ai_helper_title_suggestions_agent` (any agent is accepted, and one without an array response format replies with plain text) and on the provider honouring the schema. Any non-Array reply made `suggest_title` fail with `undefined method 'flatten' for an instance of String`, surfaced as a generic 500 by the hijacked request.
This change normalizes the reply where a list is expected, keeping only non-blank string suggestions, so a reply that isn't a list shows "No suggestions available" instead of erroring. It also drops the array clean-up in `generate_prompt`, which this now covers.
Reported in https://meta.discourse.org/t/414790