See Discourse AI - Large Language Model (LLM) settings page. Also look at Getting discourse ai to work with ollama locally and Self-Hosting an OpenSource LLM for DiscourseAI.