diff --git a/frontends/search/src/components/UploadFile.tsx b/frontends/search/src/components/UploadFile.tsx index 1b54c012e..5d6f5570a 100644 --- a/frontends/search/src/components/UploadFile.tsx +++ b/frontends/search/src/components/UploadFile.tsx @@ -17,7 +17,11 @@ interface RequestBody { group_tracking_id?: string; metadata: any; time_stamp?: string; - use_pdf2md_ocr?: boolean; + pdf2md_options?: { + use_pdf2md_ocr: boolean; + system_prompt?: string; + split_headings?: boolean; + }; } export const UploadFile = () => { @@ -40,7 +44,10 @@ export const UploadFile = () => { const [targetSplitsPerChunk, setTargetSplitsPerChunk] = createSignal(20); const [rebalanceChunks, setRebalanceChunks] = createSignal(false); const [useGptChunking, setUseGptChunking] = createSignal(false); + const [useHeadingBasedChunking, setUseHeadingBasedChunking] = + createSignal(false); const [groupTrackingId, setGroupTrackingId] = createSignal(""); + const [systemPrompt, setSystemPrompt] = createSignal(""); const [showFileInput, setShowFileInput] = createSignal(true); const [showFolderInput, setShowFolderInput] = createSignal(false); @@ -145,7 +152,11 @@ export const UploadFile = () => { split_delimiters: splitDelimiters(), target_splits_per_chunk: targetSplitsPerChunk(), rebalance_chunks: rebalanceChunks(), - use_pdf2md_ocr: useGptChunking(), + pdf2md_options: { + use_pdf2md_ocr: useGptChunking(), + split_headings: useHeadingBasedChunking(), + system_prompt: systemPrompt(), + }, group_tracking_id: groupTrackingId() === "" ? undefined : groupTrackingId(), // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment @@ -339,6 +350,36 @@ export const UploadFile = () => { onInput={(e) => setUseGptChunking(e.currentTarget.checked)} class="h-4 w-4 rounded-md border border-gray-300 bg-neutral-100 px-4 py-1 dark:bg-neutral-700" /> +
+
Heading Based Chunking
+ } + tooltipText="If set to true, Trieve will use the headings in the document to chunk the text." + /> +
+ + setUseHeadingBasedChunking(e.currentTarget.checked) + } + class="h-4 w-4 rounded-md border border-gray-300 bg-neutral-100 px-4 py-1 dark:bg-neutral-700" + /> +
+
+
System Prompt
+ } + tooltipText="System prompt to use when chunking. This is an optional field which allows you to specify the system prompt to use when chunking the text. If not specified, the default system prompt is used. However, you may want to use a different system prompt." + /> +
+