-
Notifications
You must be signed in to change notification settings - Fork 0
fix(chat): scaffold a Markdown renderer so chat renders answers #3358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fef28cf
fix(chat): render assistant Markdown through a built-in extension
kojiwakayama 2fbb14b
feat(markdown): render LaTeX math, and address review findings
kojiwakayama a902356
build: refresh proxy dependency lock for markdown math deps
kojiwakayama 9b26997
fix(chat): scaffold a Markdown renderer so chat renders answers
kojiwakayama 9d0ef95
docs: refresh generated API reference for the chat prose styling
kojiwakayama a19dd48
fix(templates): make the scaffolded Markdown renderer type-check
kojiwakayama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| "use client"; | ||
|
|
||
| import ReactMarkdown from "react-markdown"; | ||
| import remarkGfm from "remark-gfm"; | ||
| import type { MarkdownRendererProps } from "veryfront/markdown"; | ||
|
|
||
| /** | ||
| * Rich Markdown for assistant answers. | ||
| * | ||
| * `veryfront/markdown` presents plain source until a renderer is installed, so | ||
| * this component supplies one. Swap in any renderer that accepts | ||
| * `MarkdownRendererProps` to change how answers are parsed and rendered. | ||
| */ | ||
| export function MarkdownRenderer({ source }: MarkdownRendererProps): React.JSX.Element { | ||
| return <ReactMarkdown remarkPlugins={[remarkGfm]}>{source}</ReactMarkdown>; | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| "use client"; | ||
|
|
||
| import { Chat } from "veryfront/chat"; | ||
| import { MarkdownRendererProvider } from "veryfront/markdown"; | ||
| import { MarkdownRenderer } from "./markdown-renderer.tsx"; | ||
|
|
||
| export default function ChatPage(): React.JSX.Element { | ||
| return <Chat agentId="assistant" className="h-screen" />; | ||
| return ( | ||
| <MarkdownRendererProvider renderer={MarkdownRenderer}> | ||
| <Chat agentId="assistant" className="h-screen" /> | ||
| </MarkdownRendererProvider> | ||
| ); | ||
| } |
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
16 changes: 16 additions & 0 deletions
16
cli/templates/files/coding-agent/app/markdown-renderer.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use client' | ||
|
|
||
| import ReactMarkdown from 'react-markdown' | ||
| import remarkGfm from 'remark-gfm' | ||
| import type { MarkdownRendererProps } from 'veryfront/markdown' | ||
|
|
||
| /** | ||
| * Rich Markdown for assistant answers. | ||
| * | ||
| * `veryfront/markdown` presents plain source until a renderer is installed, so | ||
| * this component supplies one. Swap in any renderer that accepts | ||
| * `MarkdownRendererProps` to change how answers are parsed and rendered. | ||
| */ | ||
| export function MarkdownRenderer({ source }: MarkdownRendererProps): React.JSX.Element { | ||
| return <ReactMarkdown remarkPlugins={[remarkGfm]}>{source}</ReactMarkdown> | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
| 'use client' | ||
|
|
||
| import { Chat } from 'veryfront/chat' | ||
| import { MarkdownRendererProvider } from 'veryfront/markdown' | ||
| import { MarkdownRenderer } from './markdown-renderer.tsx' | ||
|
|
||
| export default function CodeAgent(): React.JSX.Element { | ||
| return ( | ||
| <Chat | ||
| agentId="coder" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Describe what you want to build or fix..." | ||
| /> | ||
| <MarkdownRendererProvider renderer={MarkdownRenderer}> | ||
| <Chat | ||
| agentId="coder" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Describe what you want to build or fix..." | ||
| /> | ||
| </MarkdownRendererProvider> | ||
| ) | ||
| } |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use client' | ||
|
|
||
| import ReactMarkdown from 'react-markdown' | ||
| import remarkGfm from 'remark-gfm' | ||
| import type { MarkdownRendererProps } from 'veryfront/markdown' | ||
|
|
||
| /** | ||
| * Rich Markdown for assistant answers. | ||
| * | ||
| * `veryfront/markdown` presents plain source until a renderer is installed, so | ||
| * this component supplies one. Swap in any renderer that accepts | ||
| * `MarkdownRendererProps` to change how answers are parsed and rendered. | ||
| */ | ||
| export function MarkdownRenderer({ source }: MarkdownRendererProps): React.JSX.Element { | ||
| return <ReactMarkdown remarkPlugins={[remarkGfm]}>{source}</ReactMarkdown> | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
| 'use client' | ||
|
|
||
| import { Chat } from 'veryfront/chat' | ||
| import { MarkdownRendererProvider } from 'veryfront/markdown' | ||
| import { MarkdownRenderer } from './markdown-renderer.tsx' | ||
|
|
||
| export default function DocsChat() { | ||
| export default function DocsChat(): React.JSX.Element { | ||
| return ( | ||
| <Chat | ||
| agentId="rag" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Ask anything about your documents..." | ||
| /> | ||
| <MarkdownRendererProvider renderer={MarkdownRenderer}> | ||
| <Chat | ||
| agentId="rag" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Ask anything about your documents..." | ||
| /> | ||
| </MarkdownRendererProvider> | ||
| ) | ||
| } |
16 changes: 16 additions & 0 deletions
16
cli/templates/files/multi-agent-system/app/markdown-renderer.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 'use client' | ||
|
|
||
| import ReactMarkdown from 'react-markdown' | ||
| import remarkGfm from 'remark-gfm' | ||
| import type { MarkdownRendererProps } from 'veryfront/markdown' | ||
|
|
||
| /** | ||
| * Rich Markdown for assistant answers. | ||
| * | ||
| * `veryfront/markdown` presents plain source until a renderer is installed, so | ||
| * this component supplies one. Swap in any renderer that accepts | ||
| * `MarkdownRendererProps` to change how answers are parsed and rendered. | ||
| */ | ||
| export function MarkdownRenderer({ source }: MarkdownRendererProps): React.JSX.Element { | ||
| return <ReactMarkdown remarkPlugins={[remarkGfm]}>{source}</ReactMarkdown> | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,18 @@ | ||
| 'use client' | ||
|
|
||
| import { Chat } from 'veryfront/chat' | ||
| import { MarkdownRendererProvider } from 'veryfront/markdown' | ||
| import { MarkdownRenderer } from './markdown-renderer.tsx' | ||
|
|
||
| export default function MultiAgentChat(): React.JSX.Element { | ||
| return ( | ||
| <Chat | ||
| agentId="orchestrator" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Give the team a task..." | ||
| /> | ||
| <MarkdownRendererProvider renderer={MarkdownRenderer}> | ||
| <Chat | ||
| agentId="orchestrator" | ||
| api="/api/ag-ui" | ||
| className="flex-1 min-h-0" | ||
| placeholder="Give the team a task..." | ||
| /> | ||
| </MarkdownRendererProvider> | ||
| ) | ||
| } |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.