Add chat_history form element
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3528948. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !719 >>> <p>--- AI TRACKER METADATA ---<br> <strong>Update Summary: </strong>Chat History form element. First version that is ok - should we add tools.<br> <strong>Check-in Date: </strong>MM/DD/YYYY (US format) [When we should see progress/get an update]<br> <strong>Due Date:</strong> MM/DD/YYYY (US format) [When the issue should be fully completed]<br> <strong>Blocked by:</strong> [#XXXXXX] (New issues on new lines)<br> <strong>Additional Collaborators:</strong> @username1, @username2<br> AI Tracker found here: <a href="https://www.drupalstarforge.ai/" title="AI Tracker">https://www.drupalstarforge.ai/</a><br> --- END METADATA ---</p> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>A common thing that we will see more and more is that we want to be able to expose chat history in a nice way in forms. See for instance how its done in platform.openai.com</p> <p>To make it easier to implement this, we need a form element that is a chat history, that takes common parts of a message like user, content (text/image), tool_id, tool_result.</p> <p>It will then be represented by a array with associative arrays inside it when expressing default value.</p> <p>This is already done in the coming ai_agent_tracing module, but it fits better here so it can be reused.</p> <p>Later a field type could also be added if needed.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add the form elemt chat_history.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue