File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
templates/types/streaming/nextjs/app/components/ui/chat/chat-message Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " create-llama " : patch
3
+ ---
4
+
5
+ Fix the issue of images not showing with the sandbox URL from OpenAI's models
Original file line number Diff line number Diff line change @@ -28,8 +28,19 @@ const preprocessLaTeX = (content: string) => {
28
28
return inlineProcessedContent ;
29
29
} ;
30
30
31
+ const preprocessMedia = ( content : string ) => {
32
+ // Remove `sandbox:` from the beginning of the URL
33
+ // to fix OpenAI's models issue appending `sandbox:` to the relative URL
34
+ return content . replace ( / ( s a n d b o x | a t t a c h m e n t | s n t ) : / g, "" ) ;
35
+ } ;
36
+
37
+ const preprocessContent = ( content : string ) => {
38
+ return preprocessMedia ( preprocessLaTeX ( content ) ) ;
39
+ } ;
40
+
31
41
export default function Markdown ( { content } : { content : string } ) {
32
- const processedContent = preprocessLaTeX ( content ) ;
42
+ const processedContent = preprocessContent ( content ) ;
43
+
33
44
return (
34
45
< MemoizedReactMarkdown
35
46
className = "prose dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 break-words custom-markdown"
You can’t perform that action at this time.
0 commit comments