diff --git a/app/models/llm_model.rb b/app/models/llm_model.rb index f3244468..228c9335 100644 --- a/app/models/llm_model.rb +++ b/app/models/llm_model.rb @@ -34,6 +34,11 @@ class LlmModel < ActiveRecord::Base organization: :text, disable_native_tools: :checkbox, disable_streaming: :checkbox, + reasoning_effort: { + type: :enum, + values: %w[default low medium high], + default: "default", + }, }, mistral: { disable_native_tools: :checkbox, diff --git a/assets/javascripts/discourse/components/ai-llm-editor-form.gjs b/assets/javascripts/discourse/components/ai-llm-editor-form.gjs index dec5cb95..fb28de8a 100644 --- a/assets/javascripts/discourse/components/ai-llm-editor-form.gjs +++ b/assets/javascripts/discourse/components/ai-llm-editor-form.gjs @@ -114,10 +114,26 @@ export default class AiLlmEditorForm extends Component { @computed("args.model.provider") get metaProviderParams() { - return ( + const params = this.args.llms.resultSetMeta.provider_params[this.args.model.provider] || - {} - ); + {}; + + return Object.entries(params).map(([field, value]) => { + if (typeof value === "string") { + return { field, type: value }; + } else if (typeof value === "object") { + if (value.values) { + value = { ...value }; + value.values = value.values.map((v) => { + return { id: v, name: v }; + }); + } + this.args.model.provider_params[field] = + this.args.model.provider_params[field] || value.default; + return { field, ...value }; + } + return { field, type: "text" }; // fallback + }); } @action @@ -275,24 +291,31 @@ export default class AiLlmEditorForm extends Component { /> - {{#each-in this.metaProviderParams as |field type|}} -
+ {{#each this.metaProviderParams as |param|}} +
- {{#if (eq type "checkbox")}} + {{#if (eq param.type "enum")}} + + {{else if (eq param.type "checkbox")}} {{else}} {{/if}}
- {{/each-in}} + {{/each}}