Skip to content

Commit 0b95427

Browse files
Fix error on code block
1 parent 5605992 commit 0b95427

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

workshop-ui/src/components/chat/Message.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import styles from "./Message.module.css"
1010
import { getOutputFromChildren, getScriptContentFromChildren, hashString } from "@/lib/utility";
1111
import Callout from "@/components/Callout";
1212
import CodeHighlight from "@/components/CodeHighlight";
13-
import { randomUUID } from "crypto";
1413

1514
export type Message = TextMessage | HtmlMessage;
1615

@@ -46,9 +45,8 @@ export default memo(function Message({
4645
code(props: any) {
4746
const { children, className } = props;
4847
const language = className?.includes('language-') ? className : '';
49-
const key = `code-${hashString(children || randomUUID())}`;
50-
51-
if (children.startsWith('<|TOOL_CODE_INTERPRETER|>')) {
48+
const key = `code-${hashString(children || crypto.randomUUID())}`;
49+
if (children?.startsWith('<|TOOL_CODE_INTERPRETER|>')) {
5250
const text = children;
5351
const content = getScriptContentFromChildren(text.replace('<|TOOL_CODE_INTERPRETER|>', '').split('<|OUTPUT|>')[0].trim());
5452
const output = getOutputFromChildren(text.split('<|OUTPUT|>')[1]?.trim() || null);

0 commit comments

Comments
 (0)