From 22813f8d814e6ef1e41e955d2fde669d9f95f6f6 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 24 Jun 2026 21:20:19 +0200 Subject: [PATCH] fix(extract): auto-run the AI fallback when the addon is enabled Booking import only fell back to the LLM when each user flipped an 'always retry with AI' toggle, so by default files kitinerary returned nothing for just failed. Run the fallback automatically whenever the AI Parsing addon is on (fallback-on-empty); drop the now-redundant per-user toggle and its setting. --- .../components/Planner/BookingImportModal.tsx | 8 ++--- .../Settings/DisplaySettingsTab.tsx | 31 ------------------- client/src/types.ts | 1 - server/src/services/settingsService.ts | 5 +-- 4 files changed, 4 insertions(+), 41 deletions(-) diff --git a/client/src/components/Planner/BookingImportModal.tsx b/client/src/components/Planner/BookingImportModal.tsx index 84357228..e8b38e02 100644 --- a/client/src/components/Planner/BookingImportModal.tsx +++ b/client/src/components/Planner/BookingImportModal.tsx @@ -7,7 +7,6 @@ import { useTranslation } from '../../i18n' import { useToast } from '../shared/Toast' import { reservationsApi, healthApi } from '../../api/client' import { useTripStore } from '../../store/tripStore' -import { useSettingsStore } from '../../store/settingsStore' interface BookingImportModalProps { isOpen: boolean @@ -55,7 +54,6 @@ export default function BookingImportModal({ isOpen, onClose, tripId, pushUndo } const { t } = useTranslation() const toast = useToast() const loadTrip = useTripStore((s) => s.loadTrip) - const alwaysRetryAi = useSettingsStore((s) => s.settings.llm_always_retry) const fileInputRef = useRef(null) const mouseDownTarget = useRef(null) @@ -139,9 +137,9 @@ export default function BookingImportModal({ isOpen, onClose, tripId, pushUndo } setLoading(true) setError('') try { - // When the user opted into "always retry with AI", rescue files kitinerary - // can't read automatically; otherwise offer a per-file retry in the preview. - const mode = aiParsing && alwaysRetryAi ? 'fallback-on-empty' : 'no-ai' + // Auto-rescue: whenever AI parsing is available, files kitinerary can't + // read fall back to the LLM automatically — no extra confirmation step. + const mode = aiParsing ? 'fallback-on-empty' : 'no-ai' const result = await reservationsApi.importBookingPreview(tripId, files, mode) setPreviewItems(result.items ?? []) setWarnings(result.warnings ?? []) diff --git a/client/src/components/Settings/DisplaySettingsTab.tsx b/client/src/components/Settings/DisplaySettingsTab.tsx index 42aac919..d5cb40ed 100644 --- a/client/src/components/Settings/DisplaySettingsTab.tsx +++ b/client/src/components/Settings/DisplaySettingsTab.tsx @@ -323,37 +323,6 @@ export default function DisplaySettingsTab(): React.ReactElement { - {/* Always retry booking imports with AI */} -
- -
- {[ - { value: true, label: t('settings.on') || 'On' }, - { value: false, label: t('settings.off') || 'Off' }, - ].map(opt => ( - - ))} -
-

{t('settings.aiAlwaysRetryHint')}

-
- {/* Optimize route from accommodation */}
diff --git a/client/src/types.ts b/client/src/types.ts index 23a55680..d8b347a9 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -122,7 +122,6 @@ export interface Settings { mapbox_quality_mode?: boolean // AI booking-import fallback (per-user config; used when the admin has not set // instance-wide config on the llm_parsing addon). llm_api_key is masked on read. - llm_always_retry?: boolean llm_provider?: 'local' | 'openai' | 'anthropic' llm_model?: string llm_base_url?: string diff --git a/server/src/services/settingsService.ts b/server/src/services/settingsService.ts index 059fb6ed..1755a29c 100644 --- a/server/src/services/settingsService.ts +++ b/server/src/services/settingsService.ts @@ -29,9 +29,6 @@ export const DEFAULTABLE_USER_SETTING_KEYS = [ 'llm_base_url', 'llm_multimodal', 'llm_api_key', - // "Always retry with AI" toggle — when on, the preview auto-runs the LLM on - // files kitinerary returns nothing for. - 'llm_always_retry', ] as const; type DefaultableKey = typeof DEFAULTABLE_USER_SETTING_KEYS[number]; @@ -44,7 +41,7 @@ const VALID_VALUES: Partial> = { llm_provider: ['local', 'openai', 'anthropic'], }; -const BOOLEAN_KEYS = new Set(['blur_booking_codes', 'mapbox_3d_enabled', 'mapbox_quality_mode', 'llm_multimodal', 'llm_always_retry']); +const BOOLEAN_KEYS = new Set(['blur_booking_codes', 'mapbox_3d_enabled', 'mapbox_quality_mode', 'llm_multimodal']); function parseValue(raw: string): unknown { try { return JSON.parse(raw); } catch { return raw; }