@@ -17,6 +17,7 @@ interface RequestBody {
17
17
group_tracking_id ?: string ;
18
18
metadata : any ;
19
19
time_stamp ?: string ;
20
+ use_pdf2md_ocr ?: boolean ;
20
21
}
21
22
22
23
export const UploadFile = ( ) => {
@@ -38,6 +39,7 @@ export const UploadFile = () => {
38
39
const [ splitDelimiters , setSplitDelimiters ] = createSignal ( [ "." , "?" , "\\n" ] ) ;
39
40
const [ targetSplitsPerChunk , setTargetSplitsPerChunk ] = createSignal ( 20 ) ;
40
41
const [ rebalanceChunks , setRebalanceChunks ] = createSignal ( false ) ;
42
+ const [ useGptChunking , setUseGptChunking ] = createSignal ( false ) ;
41
43
const [ groupTrackingId , setGroupTrackingId ] = createSignal ( "" ) ;
42
44
43
45
const [ showFileInput , setShowFileInput ] = createSignal ( true ) ;
@@ -136,19 +138,20 @@ export const UploadFile = () => {
136
138
} ) ;
137
139
138
140
const requestBodyTemplate : Omit < RequestBody , "base64_file" | "file_name" > =
139
- {
140
- link : link ( ) === "" ? undefined : link ( ) ,
141
- tag_set :
142
- tagSet ( ) . split ( "," ) . length > 0 ? undefined : tagSet ( ) . split ( "," ) ,
143
- split_delimiters : splitDelimiters ( ) ,
144
- target_splits_per_chunk : targetSplitsPerChunk ( ) ,
145
- rebalance_chunks : rebalanceChunks ( ) ,
146
- group_tracking_id :
147
- groupTrackingId ( ) === "" ? undefined : groupTrackingId ( ) ,
148
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
149
- metadata : metadata ( ) ,
150
- time_stamp : timestamp ( ) ? timestamp ( ) + " 00:00:00" : undefined ,
151
- } ;
141
+ {
142
+ link : link ( ) === "" ? undefined : link ( ) ,
143
+ tag_set :
144
+ tagSet ( ) . split ( "," ) . length > 0 ? undefined : tagSet ( ) . split ( "," ) ,
145
+ split_delimiters : splitDelimiters ( ) ,
146
+ target_splits_per_chunk : targetSplitsPerChunk ( ) ,
147
+ rebalance_chunks : rebalanceChunks ( ) ,
148
+ use_pdf2md_ocr : useGptChunking ( ) ,
149
+ group_tracking_id :
150
+ groupTrackingId ( ) === "" ? undefined : groupTrackingId ( ) ,
151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
152
+ metadata : metadata ( ) ,
153
+ time_stamp : timestamp ( ) ? timestamp ( ) + " 00:00:00" : undefined ,
154
+ } ;
152
155
153
156
const uploadFilePromises = files ( ) . map ( async ( file ) => {
154
157
let base64File = await toBase64 ( file ) ;
@@ -323,15 +326,27 @@ export const UploadFile = () => {
323
326
onInput = { ( e ) => setRebalanceChunks ( e . currentTarget . checked ) }
324
327
class = "h-4 w-4 rounded-md border border-gray-300 bg-neutral-100 px-4 py-1 dark:bg-neutral-700"
325
328
/>
329
+ < div class = "flex flex-row items-center space-x-2" >
330
+ < div > Use gpt4o chunking</ div >
331
+ < Tooltip
332
+ body = { < BsInfoCircle /> }
333
+ tooltipText = "Use gpt4o chunking. If set to true, Trieve will use the gpt4o model to chunk the document if it is a pdf file. This is an experimental feature and may not work as expected."
334
+ />
335
+ </ div >
336
+ < input
337
+ type = "checkbox"
338
+ checked = { useGptChunking ( ) }
339
+ onInput = { ( e ) => setUseGptChunking ( e . currentTarget . checked ) }
340
+ class = "h-4 w-4 rounded-md border border-gray-300 bg-neutral-100 px-4 py-1 dark:bg-neutral-700"
341
+ />
326
342
</ div >
327
343
</ Show >
328
344
< div class = "m-1 mb-1 flex flex-row gap-2" >
329
345
< button
330
- class = { `rounded border-2 border-magenta p-2 px-4 font-semibold ${
331
- showFileInput ( )
346
+ class = { `rounded border-2 border-magenta p-2 px-4 font-semibold ${ showFileInput ( )
332
347
? "bg-magenta-600 text-white"
333
348
: "text-magenta hover:bg-magenta-500 hover:text-white"
334
- } `}
349
+ } `}
335
350
onClick = { ( ) => {
336
351
setFiles ( [ ] ) ;
337
352
setShowFileInput ( true ) ;
@@ -341,11 +356,10 @@ export const UploadFile = () => {
341
356
Select Files
342
357
</ button >
343
358
< button
344
- class = { `rounded border-2 border-magenta p-2 px-4 font-semibold ${
345
- showFolderInput ( )
359
+ class = { `rounded border-2 border-magenta p-2 px-4 font-semibold ${ showFolderInput ( )
346
360
? "bg-magenta-600 text-white"
347
361
: "text-magenta hover:bg-magenta-500 hover:text-white"
348
- } `}
362
+ } `}
349
363
onClick = { ( ) => {
350
364
setFiles ( [ ] ) ;
351
365
setShowFolderInput ( true ) ;
0 commit comments