Skip to content

Commit 1c59389

Browse files
authored
Merge pull request #239 from Trynax/fix/code-block-backticks
Fix/code block backticks
2 parents 588d2b5 + 90c8dae commit 1c59389

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/app/(general)/_components/chat/messages/utils/llm-code-block.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@ export const LLMCodeBlock: LLMOutputComponent = ({ blockMatch }) => {
1313
return null;
1414
}
1515

16-
return <CodeBlock value={code} language={language as BundledLanguage} />;
16+
// @llm-ui/code bug: failing to remove trailing backticks
17+
const cleanedCode = code.replace(/```\s*$/, "").trim();
18+
19+
return (
20+
<CodeBlock value={cleanedCode} language={language as BundledLanguage} />
21+
);
1722
};

0 commit comments

Comments
 (0)