Handle errors for API explorers when a provider not configured
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3519196. -->
Reported by: [prashant.c](https://www.drupal.org/user/1936756)
Related to !565
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>When the provider for the AI is not configured, such as the provider module is enabled for key that is not configured, then most of the API explorers do not show any user-friendly message, instead throwing an error in the console or the "Response will appear here" section of the API explorer itself. </p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<ul>
<li>Enable a provider, say <a href="https://www.drupal.org/project/ai_provider_openai">https://www.drupal.org/project/ai_provider_openai</a></li>
<li>Do not create a key for it</li>
<li>Go to the explorers admin/config/ai/explorers</li>
<li>Try each of the explorers</li>
<li>Observe the console errors and "Response will appear here." section on the explorer page</li>
<li>
</ul>
<p>Following screenshot is from the Chat explorer:<br>
<img src="https://www.drupal.org/files/issues/2025-04-15/Chat-Generation-Explorer-Drush-Site-Install-04-15-2025_10_50_AM.png" alt="Chat explorer error"></p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>Show user-friendly error or warning messages to configure the provider.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>TBD</p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>NA</p>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
issue