From 88c9d609865223dfd882a6587183d7dade497269 Mon Sep 17 00:00:00 2001 From: Mike Fortman Date: Fri, 19 Sep 2025 12:04:23 -0500 Subject: [PATCH] add docling presets --- config.yaml | 6 +- frontend/components/ui/radio-group.tsx | 44 +++++++++ frontend/package-lock.json | 33 +++++++ frontend/package.json | 1 + .../mutations/useUpdateFlowSettingMutation.ts | 3 +- .../app/api/queries/useGetSettingsQuery.ts | 3 +- frontend/src/app/settings/page.tsx | 98 +++++++++++++------ frontend/src/components/layout-wrapper.tsx | 2 +- src/api/settings.py | 23 ++--- 9 files changed, 156 insertions(+), 57 deletions(-) create mode 100644 frontend/components/ui/radio-group.tsx diff --git a/config.yaml b/config.yaml index 9de79618..3bafb8bd 100644 --- a/config.yaml +++ b/config.yaml @@ -20,10 +20,8 @@ knowledge: chunk_size: 1000 # Overlap between chunks chunk_overlap: 200 - # Enable OCR for image processing - ocr: true - # Enable picture descriptions using vision models - picture_descriptions: false + # Docling preset setting + doclingPresets: standard # AI agent configuration agent: diff --git a/frontend/components/ui/radio-group.tsx b/frontend/components/ui/radio-group.tsx new file mode 100644 index 00000000..0968c2a8 --- /dev/null +++ b/frontend/components/ui/radio-group.tsx @@ -0,0 +1,44 @@ +"use client" + +import * as React from "react" +import * as RadioGroupPrimitive from "@radix-ui/react-radio-group" +import { Circle } from "lucide-react" + +import { cn } from "@/lib/utils" + +const RadioGroup = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + ) +}) +RadioGroup.displayName = RadioGroupPrimitive.Root.displayName + +const RadioGroupItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => { + return ( + + + + + + ) +}) +RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName + +export { RadioGroup, RadioGroupItem } \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 512417b5..58d78031 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -19,6 +19,7 @@ "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-navigation-menu": "^1.2.13", "@radix-ui/react-popover": "^1.1.15", + "@radix-ui/react-radio-group": "^1.3.8", "@radix-ui/react-select": "^2.2.5", "@radix-ui/react-separator": "^1.1.7", "@radix-ui/react-slider": "^1.3.6", @@ -1819,6 +1820,38 @@ } } }, + "node_modules/@radix-ui/react-radio-group": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/@radix-ui/react-radio-group/-/react-radio-group-1.3.8.tgz", + "integrity": "sha512-VBKYIYImA5zsxACdisNQ3BjCBfmbGH3kQlnFVqlWU4tXwjy7cGX8ta80BcrO+WJXIn5iBylEH3K6ZTlee//lgQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.3", + "@radix-ui/react-compose-refs": "1.1.2", + "@radix-ui/react-context": "1.1.2", + "@radix-ui/react-direction": "1.1.1", + "@radix-ui/react-presence": "1.1.5", + "@radix-ui/react-primitive": "2.1.3", + "@radix-ui/react-roving-focus": "1.1.11", + "@radix-ui/react-use-controllable-state": "1.2.2", + "@radix-ui/react-use-previous": "1.1.1", + "@radix-ui/react-use-size": "1.1.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-roving-focus": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/@radix-ui/react-roving-focus/-/react-roving-focus-1.1.11.tgz", diff --git a/frontend/package.json b/frontend/package.json index ea1fca85..bc9eb72c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -20,6 +20,7 @@ "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-navigation-menu": "^1.2.13", "@radix-ui/react-popover": "^1.1.15", + "@radix-ui/react-radio-group": "^1.3.8", "@radix-ui/react-select": "^2.2.5", "@radix-ui/react-separator": "^1.1.7", "@radix-ui/react-slider": "^1.3.6", diff --git a/frontend/src/app/api/mutations/useUpdateFlowSettingMutation.ts b/frontend/src/app/api/mutations/useUpdateFlowSettingMutation.ts index f789ebda..5f196ebd 100644 --- a/frontend/src/app/api/mutations/useUpdateFlowSettingMutation.ts +++ b/frontend/src/app/api/mutations/useUpdateFlowSettingMutation.ts @@ -8,8 +8,7 @@ interface UpdateFlowSettingVariables { llm_model?: string; system_prompt?: string; embedding_model?: string; - ocr?: boolean; - picture_descriptions?: boolean; + doclingPresets?: string; chunk_size?: number; chunk_overlap?: number; } diff --git a/frontend/src/app/api/queries/useGetSettingsQuery.ts b/frontend/src/app/api/queries/useGetSettingsQuery.ts index 17d050a0..734fe1df 100644 --- a/frontend/src/app/api/queries/useGetSettingsQuery.ts +++ b/frontend/src/app/api/queries/useGetSettingsQuery.ts @@ -13,8 +13,7 @@ export interface KnowledgeSettings { embedding_model?: string; chunk_size?: number; chunk_overlap?: number; - ocr?: boolean; - picture_descriptions?: boolean; + doclingPresets?: string; } export interface Settings { diff --git a/frontend/src/app/settings/page.tsx b/frontend/src/app/settings/page.tsx index 0a858f6e..8efcf8d6 100644 --- a/frontend/src/app/settings/page.tsx +++ b/frontend/src/app/settings/page.tsx @@ -22,6 +22,7 @@ import { import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Select, SelectContent, @@ -100,6 +101,7 @@ function KnowledgeSourcesPage() { const [systemPrompt, setSystemPrompt] = useState(""); const [chunkSize, setChunkSize] = useState(1024); const [chunkOverlap, setChunkOverlap] = useState(50); + const [processingMode, setProcessingMode] = useState("standard"); // Fetch settings using React Query const { data: settings = {} } = useGetSettingsQuery({ @@ -175,6 +177,13 @@ function KnowledgeSourcesPage() { } }, [settings.knowledge?.chunk_overlap]); + // Sync processing mode with settings data + useEffect(() => { + if (settings.knowledge?.doclingPresets) { + setProcessingMode(settings.knowledge.doclingPresets); + } + }, [settings.knowledge?.doclingPresets]); + // Update model selection immediately const handleModelChange = (newModel: string) => { updateFlowSettingMutation.mutate({ llm_model: newModel }); @@ -204,6 +213,12 @@ function KnowledgeSourcesPage() { debouncedUpdate({ chunk_overlap: numValue }); }; + // Update processing mode + const handleProcessingModeChange = (mode: string) => { + setProcessingMode(mode); + debouncedUpdate({ doclingPresets: mode }); + }; + // Helper function to get connector icon const getConnectorIcon = useCallback((iconName: string) => { @@ -777,40 +792,59 @@ function KnowledgeSourcesPage() { - {/*
-
- -
- Extracts text from images/PDFs. Ingest is slower when enabled. +
+ + +
+ +
+ +
+ Fast ingest for text-based documents without images +
+
-
- +
+ +
+ +
+ Uses OCR to extract text from images/PDFs. Ingest is slower when enabled +
+
+
+
+ +
+ +
+ Text extraction plust AI generated image descriptions +
+
+
+
+ +
+ +
+ Advanced processing with vision language models. Highest quality but most expensive +
+
+
+
-
-
- -
- Adds captions for images. Ingest is more expensive when - enabled. -
-
- -
*/}
diff --git a/frontend/src/components/layout-wrapper.tsx b/frontend/src/components/layout-wrapper.tsx index d092dcc1..ba8d7797 100644 --- a/frontend/src/components/layout-wrapper.tsx +++ b/frontend/src/components/layout-wrapper.tsx @@ -104,7 +104,7 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) {