UI text inconsistencies and user experience issues of main assistant plugin
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3464266. -->
Reported by: [jurriaanroelofs](https://www.drupal.org/user/52638)
Related to !1241
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<ul>
<li>Microcopy is sometimes inconsistent; for example, in the Action dropdown, "Completion" is not an action but a noun.</li>
<li>Some terms are not well understood by non-technical users, many of whom are content editors.</li>
<li>Users expect the "completion" function in the generic AI assistant plugin to work with selected text and generate new text in place, similar to the CKEditor premium "AI" plugin.</li>
<li>Responses in formats other than plain text are currently ingested as markdown, but they should be ingested as HTML.</li>
</ul>
<h3 id="summary-proposed-resolution">Proposed Resolution</h3>
<ul>
<li>Refine microcopy following UX best practices and WCAG accessibility recommendations.</li>
<li>Add support for editing selected text in the Completion.php plugin.</li>
<li>Accept HTML, limited to the elements allowed by the CKEditor data model based on its configuration.</li>
</ul>
<h3 id="summary-remaining-tasks">Remaining Tasks</h3>
<ul>
<li>Add an "Insert below" button similar to the CKEditor 5 premium plugin. This feature would allow users to select text and prompt the AI to "write the next paragraph," inserting the new content below without returning all pre-existing content, reducing token usage.</li>
<li>Support HTML for selected text, enabling actions like transposing a table or adding a new column with data.</li>
</ul>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>Supporting HTML:<br>
<img src="https://www.drupal.org/files/issues/2024-07-28/ai-assistant-HTML.gif" alt="HTML support"></p>
<p>Completion.php supporting text selection optionally:<br>
<img src="https://www.drupal.org/files/issues/2024-07-28/ai-assistant-selection-workflow.gif" alt="text selection"></p>
<p>Microcopy (UI text) updates:</p>
<table>
<thead>
<tr>
<th>Element</th>
<th>Before</th>
<th>After</th>
</tr>
</thead>
<tbody>
<tr>
<td>Plugin Label</td>
<td>Completion</td>
<td>Generate or Edit</td>
</tr>
<tr>
<td>Plugin Description</td>
<td>Get ideas and text completion assistance from AI.</td>
<td>Generate or edit content with AI assistance.</td>
</tr>
<tr>
<td>Configuration Form Title</td>
<td>AI provider</td>
<td>Select AI provider</td>
</tr>
<tr>
<td>Configuration Form Description</td>
<td>Select which provider to use for this plugin. See the <a href="https://www.drupal.org:link">Provider overview</a> for details about each provider.</td>
<td>Select an AI provider. <a href="https://www.drupal.org:link">Learn more about providers</a>.</td>
</tr>
<tr>
<td>Modal Form Title (AI Instruction)</td>
<td>What would you like to ask or get ideas for?</td>
<td>AI instruction</td>
</tr>
<tr>
<td>Modal Form Title (Response)</td>
<td>Response from AI</td>
<td>AI response</td>
</tr>
<tr>
<td>Modal Form Description (Response)</td>
<td>The response from AI will appear in the box above. You can edit and tweak the response before saving it back to the editor.</td>
<td>Optionally, edit the AI response above before saving.</td>
</tr>
<tr>
<td>Generate Button Text</td>
<td>Generate</td>
<td>Generate content</td>
</tr>
<tr>
<td>Submit Button Text</td>
<td>Save changes to editor</td>
<td>Save changes</td>
</tr>
<tr>
<td>Error Message</td>
<td>There was an error in the Completion AI plugin for CKEditor.</td>
<td>AI plugin error. Please try again or contact your IT administrator.</td>
</tr>
</tbody>
</table>
<h3 id="summary-api-changes">API changes</h3>
<h3 id="summary-data-model-changes">Data model changes</h3>
> Related issue: [Issue #3464001](https://www.drupal.org/node/3464001)
issue