Skip to content

Add basic markdown support for assist chat messages#3689

Merged
bgoncal merged 9 commits intohome-assistant:masterfrom
krsilas:bats72-codex/add-markdown-support-for-messages
Jul 2, 2025
Merged

Add basic markdown support for assist chat messages#3689
bgoncal merged 9 commits intohome-assistant:masterfrom
krsilas:bats72-codex/add-markdown-support-for-messages

Conversation

@krsilas
Copy link
Copy Markdown
Contributor

@krsilas krsilas commented Jul 1, 2025

Summary

This adds basic markdown formatting for messages in assist because LLMs often respond with markdown.
It does not support common markdown features like headlines, images and tables because they are currently not natively supported in SwiftUI

Screenshots

Light mode Dark mode
Simulator Screenshot - iPhone 16 - 2025-07-01 at 20 22 07 Simulator Screenshot - iPhone 16 - 2025-07-01 at 20 36 08

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copy link
Copy Markdown
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

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

Looking great! Thanks for helping out with that.

One last request, can you also add a screenshot of how it looks in Apple Watch now? It worth testing if links are going to open in the in-app browser.

.background(backgroundForChatItemType(item.itemType))
.roundedCorner(6, corners: roundedCornersForChatItemType(item.itemType))
.foregroundColor(.white)
.tint(Color.haPrimaryDark)
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.

Same here

@home-assistant
Copy link
Copy Markdown

home-assistant bot commented Jul 2, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft July 2, 2025 06:36
@bgoncal
Copy link
Copy Markdown
Member

bgoncal commented Jul 2, 2025

For the linter issue you can use bundle exec fastlane autocorrect

@codecov
Copy link
Copy Markdown

codecov bot commented Jul 2, 2025

Codecov Report

Attention: Patch coverage is 0% with 12 lines in your changes missing coverage. Please review.

Project coverage is 45.59%. Comparing base (4f60d68) to head (d7c6c3b).
Report is 65 commits behind head on master.

Files with missing lines Patch % Lines
Sources/Shared/Assist/AssistChatItem.swift 0.00% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3689      +/-   ##
==========================================
+ Coverage   44.72%   45.59%   +0.87%     
==========================================
  Files         232      232              
  Lines       13911    14071     +160     
==========================================
+ Hits         6221     6416     +195     
+ Misses       7690     7655      -35     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@krsilas krsilas requested a review from bgoncal July 2, 2025 15:07
@krsilas krsilas marked this pull request as ready for review July 2, 2025 15:08
Copy link
Copy Markdown
Member

@bgoncal bgoncal left a comment

Choose a reason for hiding this comment

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

Out of curiosity, do you use Assist only by text? Markdown is not handled well by TTS (but that's not related to this PR goal of course)

@bgoncal bgoncal merged commit 6e58d30 into home-assistant:master Jul 2, 2025
5 checks passed
@krsilas
Copy link
Copy Markdown
Contributor Author

krsilas commented Jul 2, 2025

Out of curiosity, do you use Assist only by text? Markdown is not handled well by TTS (but that's not related to this PR goal of course)

@bgoncal Both. Depends on the situation and use case. Elevenlabs actually handles most cases just fine and uses simple markdown features for pronunciation. On voice only devices I have another assistant that has a special system prompt.

I would like to use text input more on mobile but theres also this issue: home-assistant/core#147975

@krsilas krsilas deleted the bats72-codex/add-markdown-support-for-messages branch November 15, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants