Skip to content

MBS-10672: Fix formelements display for long content#56

Open
Barbuia wants to merge 1 commit intomainfrom
MBS-10672-Fix_AI_chat_HTML_code_output
Open

MBS-10672: Fix formelements display for long content#56
Barbuia wants to merge 1 commit intomainfrom
MBS-10672-Fix_AI_chat_HTML_code_output

Conversation

@Barbuia
Copy link
Copy Markdown
Contributor

@Barbuia Barbuia commented Mar 27, 2026

  • Add truncation logic in chat.js for suggestion values > 300 chars
  • Update agent_suggestions.mustache with styled pre/code block
  • Add scrollable container and truncation indicator

@Barbuia Barbuia force-pushed the MBS-10672-Fix_AI_chat_HTML_code_output branch 2 times, most recently from 8be5644 to 8e8c96c Compare March 27, 2026 13:59
Copy link
Copy Markdown
Member

@PhMemmel PhMemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think truncation is the correct way of dealing with the layout here. Please see comments in the other PR in local_ai_manager

@Barbuia Barbuia force-pushed the MBS-10672-Fix_AI_chat_HTML_code_output branch 3 times, most recently from ad60d05 to 7cf68d0 Compare March 29, 2026 06:25
<br/><b>{{#str}}suggestionlabel, block_ai_chat{{/str}}: </b>
<details class="block_ai_chat-suggestion-details mb-2">
<summary class="btn btn-sm btn-outline-secondary">{{#str}}showsuggestion, block_ai_chat{{/str}}</summary>
<pre class="block_ai_chat-suggestion-code mt-2 p-2 bg-light border rounded"><code>{{{suggestiondisplayvalue}}}</code></pre>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggestion is not always code. It's often just plain text.

In case of plain text, for example to fill the form field "course description" it's irritating that this is in a single-line code field and you have to scroll to the right to see the full description.

However, a different formatting for the suggestion is a good thing. Please keep this, but it should not be formatted as "code".

Also, for longer values: If it's short enough it should just be there.
If it's long: Show the shortened text, and add a SMALL button (or probably even better: no button at all and instead make the text just clickable for toggling expanding and collapsing(.

- Add collapsible details element for suggestion values to handle HTML/code output
- Use triple mustache {{{  }}} for proper HTML rendering in suggestions
- Fix async forEach bug in _getAgentAnswerTemplateContext (was not awaiting)
- Add suggestiondisplayvalue fallback from backend formatting
- Add CSS styles for suggestion details and code blocks
@Barbuia Barbuia force-pushed the MBS-10672-Fix_AI_chat_HTML_code_output branch from 7cf68d0 to d0964dd Compare March 31, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants