Repository navigation
Fix Chat Interactions shows "!caption" text instead of preview images when an answer also offers a download - #236
Open
JackTelford wants to merge 1 commit into
Conversation
…wnload replaceGeneratedMarkdownLinks matched the [caption](url) inside an expanded figure image and rewrote it to its label, leaving "!caption" as text. Image syntax is now left untouched. Fixes CrestApps#235
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #235
The bug
On the MVC sample's Chat Interactions page, an answer that both previews a document and offers it as a download showed the preview captions as plain text with a stray
!(!Slide 9: Executive Summary: Key KPIs) instead of the images. It affected the PowerPoint, Word and PDF agents alike. Previews without a download rendered fine, which made it look intermittent.Why it happened
Chat.cshtmlhas its own inline rendering pipeline:expandImageMarkersturns[fig:N]into.replaceGeneratedMarkdownLinksrewrites markdown links with/\[([^\]]+)\]\(([^)]+)\)/g.[caption](url)inside the image syntax. The image matched no download, so it was replaced by its label, leaving!captionas text before markdown ran.The fix
The pattern now also captures an optional leading
!. When it is present, the match is image markdown and is returned untouched. Ordinary links are handled exactly as before.Scope
src/Startup/CrestApps.Core.Mvc.Web/Areas/ChatInteractions/Views/ChatInteraction/Chat.cshtml.ai-chat.jsandchat-interaction.jsnever had this function and are unchanged.How to test
In a Chat Interaction with the presentation tools, send:
Expected: the slide previews render as an image carousel, and the
.pptxlink appears below them. The same check applies to Word (.docx) and PDF (.pdf).🤖 Generated with Claude Code