discourse/plugins/discourse-ai/discourse_workflows/nodes/ai_agent
Joffrey JAFFEUX 3bd35ee415
PERF: Avoid N+1 LLM lookups in AI agent node options (#40984)
The workflow AI agent node's `agent_options` looked up each agent's
configured LLM with a separate `LlmModel.find_by` inside a `.map`,
issuing one query per enabled agent (plus one for the site default).

Collect the distinct LLM ids up front and resolve them with a single
`LlmModel.where(id: ids).index_by(&:id)`. The now-unused
`default_llm_model`/`find_llm_model` helpers are removed.
2026-06-17 14:11:28 +02:00
..
v1.rb PERF: Avoid N+1 LLM lookups in AI agent node options (#40984) 2026-06-17 14:11:28 +02:00