Default values for provider configuration parameters are not set in AiProviderFormHelper service
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3543333. --> Reported by: [jibla](https://www.drupal.org/user/1013184) Related to !1088 !856 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When using <code>AiProviderFormHelper</code> service to generate provider selection and configuration management forms, default values although passed, are not set to model configuration form fields.</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <p>Please provide information like AI modules enabled, which AI provider, browser, etc.</p> <p>Call <code>generateAiProvidersForm</code> method of <code>AiProviderFormHelper</code> service, pass <code>&amp;$form</code> with values set for parameters like <code>temperature</code>, <code>topN</code> and others. Returned form elements will not have default values set.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Between these two lines, we need to make sure values are mapped form $form to $configuration:</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>$configuration </span><span style="color: #007700">= </span><span style="color: #0000BB">$llmInstance</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getAvailableConfiguration</span><span style="color: #007700">(</span><span style="color: #0000BB">$operation_type</span><span style="color: #007700">, </span><span style="color: #0000BB">$model</span><span style="color: #007700">);<br></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">generateFormElements</span><span style="color: #007700">(</span><span style="color: #0000BB">$prefix </span><span style="color: #007700">. </span><span style="color: #DD0000">'ajax_prefix'</span><span style="color: #007700">, </span><span style="color: #0000BB">$form</span><span style="color: #007700">, </span><span style="color: #0000BB">$config_level</span><span style="color: #007700">, </span><span style="color: #0000BB">$configuration</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?&gt;</span></span></pre></div>
issue