feat: add markdown parsing for ai summaries (#569, #786)#1002
feat: add markdown parsing for ai summaries (#569, #786)#1002spacecowboy merged 3 commits intospacecowboy:masterfrom
Conversation
spacecowboy
left a comment
There was a problem hiding this comment.
Overall it looks good to me. See one comment about performance issue though.
And sorry for the long delay, I've been busy IRL
| val markdownConverter = remember { MarkdownToHtmlConverter() } | ||
| val htmlContent = | ||
| remember(summary.value.content) { | ||
| markdownConverter.convertToHtml(summary.value.content) | ||
| } | ||
|
|
||
| // Convert HTML to AnnotatedString for rich text display | ||
| val annotatedStrings = | ||
| remember(htmlContent) { | ||
| htmlStringToAnnotatedString(htmlContent) | ||
| } |
There was a problem hiding this comment.
You are converting the text to markdown and then annotatedString on the UI-thread.
This should be moved inside ArticleViewModel such that the final annotated string is part of the OpenAISummaryState.Result from the start
913bee1 to
6bb75f3
Compare
No worries at all, it's in no way a critical feature, just a day to day minor QoL thing. I've moved the annotated string to the ArticleViewModel and added a field to the Result, and I avoid putting the error string through the markdown parser to avoid mangling it when visualizing. Let me know if that's what you meant or if I'm missing something still. |
This PR adds comprehensive markdown rendering capabilities to AI-generated article summaries, transforming plain text responses into properly formatted, visually appealing content.
Let me know what you think and what changes you'd like to see.