File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
src/client/components/Rag Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export const Chunk: React.FC<{
16
16
< Typography variant = "subtitle1" fontFamily = "monospace" mb = { 2 } >
17
17
{ JSON . stringify ( doc . metadata , null , 2 ) }
18
18
</ Typography >
19
- { doc . metadata ?. type === 'md' ? (
19
+ { doc . metadata ?. type === 'md' || doc . metadata ?. type === 'pdf' ? (
20
20
< Markdown > { doc . content } </ Markdown >
21
21
) : (
22
22
< Typography whiteSpace = "pre-line" variant = "body1" >
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type { RagIndexAttributes } from '../../../server/db/models/ragIndex'
8
8
import { Chunk } from './Chunk'
9
9
import { useDeleteRagFileMutation } from './api'
10
10
import { useTranslation } from 'react-i18next'
11
+ import Markdown from 'react-markdown'
11
12
12
13
type RagFile = RagFileAttributes & {
13
14
fileContent : string
@@ -69,14 +70,12 @@ export const RagFile: React.FC = () => {
69
70
< Typography variant = "h4" > { t ( 'rag:content' ) } </ Typography >
70
71
{ ragFile . fileContent . length === 0 ? (
71
72
< Typography variant = "body1" > { t ( 'rag:noContent' ) } </ Typography >
73
+ ) : ragFile . fileType === 'application/pdf' || ragFile . fileType === 'text/markdown' ? (
74
+ < Markdown > { ragFile . fileContent } </ Markdown >
72
75
) : (
73
- < Chunk
74
- doc = { {
75
- title : ragFile . filename ,
76
- content : ragFile . fileContent ,
77
- metadata : ragFile . metadata ,
78
- } }
79
- />
76
+ < Typography variant = "body1" style = { { whiteSpace : 'pre-wrap' , fontFamily : 'monospace' } } >
77
+ { ragFile . fileContent }
78
+ </ Typography >
80
79
) }
81
80
</ Container >
82
81
)
You can’t perform that action at this time.
0 commit comments