fix(web-ui): resolve relative markdown images in chat - #1473
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Web UI chat rendering so relative Markdown image links emitted by the assistant (e.g. ) are resolved against the active session workspace, enabling inline previews for images generated into the workspace.
Changes:
- Pass the active session workspace path from
FlowTextBlockinto the Markdown renderer asbasePath. - Update the Markdown image render path to resolve images using
basePathwhen present, otherwise fall back to the resolvedcurrentWorkspacePath. - Add a unit test asserting that relative Markdown images are loaded via
workspaceAPI.readFileContentusing the providedbasePath.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/web-ui/src/flow_chat/components/FlowTextBlock.tsx | Provides a workspace-derived basePath to the chat Markdown renderer so relative images resolve in-session. |
| src/web-ui/src/component-library/components/Markdown/Markdown.tsx | Ensures <img> rendering uses basePath or currentWorkspacePath so relative image sources resolve reliably. |
| src/web-ui/src/component-library/components/Markdown/Markdown.test.tsx | Adds coverage for loading relative Markdown images via the provided basePath and avoids unnecessary workspace lookups. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Resolve relative Markdown image paths in assistant chat messages against the active session workspace, so model output such as
can render the generated image inline.Fixes #1473
Type and Areas
Type: bug fix
Areas: web UI, flow chat, Markdown rendering
Motivation / Impact
Agents can generate images into the workspace and reference them from assistant Markdown output. Before this change, relative Markdown image paths in chat messages were not reliably anchored to the active session workspace, so inline image previews could fail.
This change passes the active session workspace path into the chat Markdown renderer and uses that path when resolving relative Markdown image links. The existing workspace file-reading path is reused for loading image content.
Verification
pnpm --dir src/web-ui run test:run src/component-library/components/Markdown/Markdown.test.tsxpnpm run type-check:web