mirror of
https://github.com/we-promise/sure.git
synced 2026-07-19 00:05:23 +00:00
feat(ai): honor Setting.llm_provider for batch and PDF flows (#2265)
Auto-categorization, merchant detection/enhancement, and PDF/bank-statement extraction hard-coded Provider::Registry.get_provider(:openai), so selecting Anthropic (or running an Anthropic-only self-hosted install) left those operations using/missing OpenAI rather than the chosen provider. Add Provider::Registry.preferred_llm_provider, which resolves the LLM provider honoring Setting.llm_provider with a configured-provider fallback (mirroring how chat picks its provider), and route all six TODO(#2113) call sites through it: - Family::AutoCategorizer#llm_provider - Family::AutoMerchantDetector#llm_provider - ProviderMerchant::Enhancer#llm_provider - PdfImport (process_pdf + extract_bank_statement) - Assistant::Function::ImportBankStatement Provider::Anthropic already implements auto_categorize / auto_detect_merchants / enhance_provider_merchants (#1984) and process_pdf / extract_bank_statement (#1985), so no provider changes are needed — only the wiring. Closes #2113.
This commit is contained in:
committed by
GitHub
parent
c375b8bf5c
commit
f25fe30a41
@@ -92,15 +92,15 @@ class Assistant::Function::ImportBankStatement < Assistant::Function
|
||||
}
|
||||
end
|
||||
|
||||
# Extract transactions from the PDF using provider
|
||||
# TODO(#2113): hardcoded to OpenAI. Provider::Anthropic implements
|
||||
# extract_bank_statement (PR #1985); this should honor Setting.llm_provider.
|
||||
provider = Provider::Registry.get_provider(:openai)
|
||||
# Extract transactions from the PDF using the configured LLM provider.
|
||||
# Honors Setting.llm_provider (issue #2113) — Provider::Anthropic implements
|
||||
# extract_bank_statement (PR #1985).
|
||||
provider = Provider::Registry.preferred_llm_provider
|
||||
unless provider
|
||||
return {
|
||||
success: false,
|
||||
error: "provider_not_configured",
|
||||
message: "OpenAI provider is not configured"
|
||||
message: "AI provider is not configured"
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user