fraudTech commited on
Commit
6dbbcff
·
1 Parent(s): ed2f640

fix plot display

Browse files
Files changed (1) hide show
  1. web/src/App.tsx +10 -1
web/src/App.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import React, { useState, useRef, useEffect } from 'react';
2
- import ReactMarkdown from 'react-markdown';
3
  import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4
  import remarkMath from 'remark-math';
5
  import remarkGfm from 'remark-gfm';
@@ -65,6 +65,14 @@ const terminalTheme = {
65
  important: { color: '#d4a574', fontWeight: 'bold' },
66
  };
67
 
 
 
 
 
 
 
 
 
68
  interface Message {
69
  id: string;
70
  role: 'user' | 'assistant' | 'system';
@@ -694,6 +702,7 @@ function App() {
694
  remarkGfm
695
  ]}
696
  rehypePlugins={[rehypeKatex]}
 
697
  components={{
698
  code({ className, children, ...props }: any) {
699
  const match = /language-(\w+)/.exec(className || '');
 
1
  import React, { useState, useRef, useEffect } from 'react';
2
+ import ReactMarkdown, { defaultUrlTransform } from 'react-markdown';
3
  import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4
  import remarkMath from 'remark-math';
5
  import remarkGfm from 'remark-gfm';
 
65
  important: { color: '#d4a574', fontWeight: 'bold' },
66
  };
67
 
68
+ const allowDataImageUrl = (url: string): string => {
69
+ if (url.startsWith('data:image/')) {
70
+ return url;
71
+ }
72
+
73
+ return defaultUrlTransform(url);
74
+ };
75
+
76
  interface Message {
77
  id: string;
78
  role: 'user' | 'assistant' | 'system';
 
702
  remarkGfm
703
  ]}
704
  rehypePlugins={[rehypeKatex]}
705
+ urlTransform={allowDataImageUrl}
706
  components={{
707
  code({ className, children, ...props }: any) {
708
  const match = /language-(\w+)/.exec(className || '');