Limekiller / moodle-block_openai_chat

An AI chat block for Moodle, powered by GPT
https://moodle.org/plugins/block_openai_chat
GNU General Public License v3.0
29 stars 18 forks source link

Render HTML in the chat messages, esp. for ChatGPT's code examples. #16

Closed fishfree closed 10 months ago

fishfree commented 1 year ago

As mentioned in the title. Thanks!

Limekiller commented 1 year ago

Hi, could you expand on what you're looking for here? Right now, the response from GPT is inserted as-is into the HTML, meaning that tags are already interpreted and rendered. I'm not super interested in providing a lot of formatting features here along the lines of the ChatGPT front end, as that balloons the complexity of the plugin -- but if you're looking for something relatively simple that provides a significant improvement I'll definitely consider it.

michael-milette commented 1 year ago

Hi @Limekiller,

The OpenAI API returns completion messages in markdown format. What is needed is to simply pass the output through Moodle's format_text() function.

Please take a look at the following PR: #27 for a solution.

Hope you find this helpful.

Best regards,

Michael Milette