优化消息里读/写内容显示样式

This commit is contained in:
xintaofei
2026-03-28 14:04:19 +08:00
parent afa67380e7
commit 8bd19738d0
22 changed files with 660 additions and 462 deletions

View File

@@ -22,6 +22,7 @@ import { useTranslations } from "next-intl"
import { isValidElement } from "react"
import { CodeBlock } from "./code-block"
import { UnifiedDiffPreview } from "@/components/diff/unified-diff-preview"
import { MessageResponse } from "./message"
export type ToolProps = ComponentProps<typeof Collapsible>
@@ -380,9 +381,10 @@ export const ToolOutput = ({
<MessageResponse>{output}</MessageResponse>
</div>
)
} else if (lang === "diff") {
Output = <UnifiedDiffPreview diffText={output} />
} else {
const language = detectOutputLanguage(output)
Output = <CodeBlock code={output} language={language} />
Output = <CodeBlock code={output} language={lang} />
}
}