fix: preserve source data and recover tool math at presentation

This commit is contained in:
amosblomqvist
2026-10-26 04:49:47 +02:00
parent b277ee3e0f
commit d3c8709bd2
21 changed files with 1134 additions and 652 deletions
+11 -1
View File
@@ -34,7 +34,7 @@ import {
type PluginConfig,
} from "streamdown";
import { mdComponents } from "@/components/md-blocks";
import { transformMathDelimiters } from "@/src/core";
import { repairMathForDisplay, transformMathDelimiters } from "@/src/core";
export type MessageProps = HTMLAttributes<HTMLDivElement> & {
from: LhViewMessage["role"];
@@ -388,6 +388,16 @@ export const MessageResponse = memo(
MessageResponse.displayName = "MessageResponse";
/** Recovery is a tool-text presentation concern, not a shape/answer-data
* transform. Ordinary assistant/user prose keeps MessageResponse unchanged. */
export function ToolContentResponse({ children, ...props }: MessageResponseProps) {
return (
<MessageResponse {...props}>
{typeof children === "string" ? repairMathForDisplay(children) : children}
</MessageResponse>
);
}
export type MessageToolbarProps = ComponentProps<"div">;
export const MessageToolbar = ({