Help With Displaying Styled Text for AI-Chatbot Conversation in RG

Hey,
I’m working with ai-chatbots and I’ve encountered a problem. The conversation with the chat is displayed in a RG (in a text element). The problem is that it doesn’t support any visual styles (bold, italic, heading, etc.).
How can I solve this? I tried replacing the text element with RTE but the UI gets messed up. Is there any other solution? Any plugin recommended?
Thank you in advance.

I do this:

For even numbered cells (assistant message), convert Markdown to HTML and display the HTML element using this plugin: Markdown Pro 🐌 + Tailwind styles (free!)

3 Likes

Will try this, thanks!

Did you build the repeating group and text element for the conversation or is it part of a plugin or some script from an AI chatbot company?

Hey @boston85719, so:

  • I use a plugin with a simple setup (link) that allows streaming responses.
  • I build a RG (type = text // datasource = plugin’s messages).
  • No script.

Then you should be able to use the layout and formatting options on the text element inside of the repeating group to get the message text display in the visual style you want. The fact that the text values come from the API as opposed to your database or static text makes no difference to the ability to format a text element to look the way you want it to look.

1 Like

Thanks @boston85719 , good to know.
My big goal is to be able to display messages the same way ChatGPTs does it:

  • Bold, italic, bullet points.
  • Headings to paragraph styles.
  • Code styling for code replies.

I have no idea how to do that so I’ll start with this (any suggestion is more than welcome):

You could try to prompt ChatGPT to provide the response using BBCode…then can just use a text element to display the response

This doesn’t do pretty code formatting, and for some reason never even worked for me at all - it just didn’t render the BBCode despite the right options being enabled. Possibly something to do with the text being references directly from a plugin.

There are no options that need to be enabled to allow a text element to render the bbcode applied to the text displayed as far as I know…it just always has worked like that out of the box. You can test this by putting into a text element something like [b]This is Bold[/b] or [i]This is Italiicized[/i] ( This is Bold or This is Italiicized ) just to demonstrate that the forum also displays BBCode properly.

You can further play with learning about BBCode via the text elements element inspector window by pressing the Rich Text Editor button under the input area and add some different formatting options and then you’ll see the BBCode applied in the input area of the text element inspector.

Likely not as it makes no difference if your data value displayed via a text element is from an API call, a plugin, a dynamic expression referencing your database, URL or just static text values…unless the plugin is for some unnecessary reason interfering with the values returned via the API call to OpenAI, and if it is, you should ditch the plugin and just connect via API directly.

Only thing that I can think of as to why it would not render properly, even if you put into the prompt to OpenAI to provide response in BBCode is that the prompt was not engineered properly and OpenAI did not provide the response in BBCode.

Have you checked that the returned value from OpenAI API call was formatted in BBCode?

This topic was automatically closed after 70 days. New replies are no longer allowed.