### Problem Users were confused because `<dyad-command>` tags were being hidden, making it unclear what actions were available. ### Solution Render dyad-command tags as visible buttons, so users can see and interact with available commands (e.g., "restart"). Closes #1421 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Show dyad-command tags as visible buttons in assistant responses so users can see and trigger actions (e.g., restart). Closes #1421. - **Bug Fixes** - Render dyad-command tags to buttons in DyadMarkdownParser. - Export mapActionToButton from ChatInput for reuse. - Support id/action/path attributes; safely no-op if parsing fails. <!-- End of auto-generated description by cubic. -->
This commit is contained in:
committed by
GitHub
parent
423a95ed81
commit
d83f5fec83
@@ -556,7 +556,7 @@ function KeepGoingButton() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapActionToButton(action: SuggestedAction) {
|
export function mapActionToButton(action: SuggestedAction) {
|
||||||
switch (action.id) {
|
switch (action.id) {
|
||||||
case "summarize-in-new-chat":
|
case "summarize-in-new-chat":
|
||||||
return <SummarizeInNewChatButton />;
|
return <SummarizeInNewChatButton />;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { DyadMcpToolResult } from "./DyadMcpToolResult";
|
|||||||
import { DyadWebSearchResult } from "./DyadWebSearchResult";
|
import { DyadWebSearchResult } from "./DyadWebSearchResult";
|
||||||
import { DyadWebSearch } from "./DyadWebSearch";
|
import { DyadWebSearch } from "./DyadWebSearch";
|
||||||
import { DyadRead } from "./DyadRead";
|
import { DyadRead } from "./DyadRead";
|
||||||
|
import { mapActionToButton } from "./ChatInput";
|
||||||
|
import { SuggestedAction } from "@/lib/schemas";
|
||||||
|
|
||||||
interface DyadMarkdownParserProps {
|
interface DyadMarkdownParserProps {
|
||||||
content: string;
|
content: string;
|
||||||
@@ -498,7 +500,12 @@ function renderCustomTag(
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
case "dyad-command":
|
case "dyad-command":
|
||||||
// Don't render anything for dyad-command
|
if (attributes.type) {
|
||||||
|
const action = {
|
||||||
|
id: attributes.type,
|
||||||
|
} as SuggestedAction;
|
||||||
|
return <>{mapActionToButton(action)}</>;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user