Spaces:
Sleeping
Sleeping
wuyiqunLu
commited on
feat: use code block for code from va (#49)
Browse files<img width="1067" alt="image"
src="https://github.com/landing-ai/vision-agent-ui/assets/132986242/27f168d9-3e08-4f3c-8668-af3831a5cace">
- components/chat/ChatMessage.tsx +8 -2
- package.json +2 -2
components/chat/ChatMessage.tsx
CHANGED
|
@@ -62,9 +62,15 @@ export function ChatMessage({
|
|
| 62 |
</p>
|
| 63 |
);
|
| 64 |
},
|
| 65 |
-
code({ children, ...props }) {
|
|
|
|
| 66 |
return (
|
| 67 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
);
|
| 69 |
},
|
| 70 |
}}
|
|
|
|
| 62 |
</p>
|
| 63 |
);
|
| 64 |
},
|
| 65 |
+
code({ children, className, ...props }) {
|
| 66 |
+
const match = /language-(\w+)/.exec(className || '');
|
| 67 |
return (
|
| 68 |
+
<CodeBlock
|
| 69 |
+
key={Math.random()}
|
| 70 |
+
language={(match && match[1]) || ''}
|
| 71 |
+
value={String(children).replace(/\n$/, '')}
|
| 72 |
+
{...props}
|
| 73 |
+
/>
|
| 74 |
);
|
| 75 |
},
|
| 76 |
}}
|
package.json
CHANGED
|
@@ -77,5 +77,5 @@
|
|
| 77 |
"tailwindcss-animate": "^1.0.7",
|
| 78 |
"typescript": "^5.3.3"
|
| 79 |
},
|
| 80 |
-
"packageManager": "[email protected].
|
| 81 |
-
}
|
|
|
|
| 77 |
"tailwindcss-animate": "^1.0.7",
|
| 78 |
"typescript": "^5.3.3"
|
| 79 |
},
|
| 80 |
+
"packageManager": "[email protected].4"
|
| 81 |
+
}
|