mirror of
https://github.com/icereed/paperless-gpt.git
synced 2025-03-12 12:58:02 -05:00
feat(ocr): add conditional initialization for OCR provider based on LLM settings
This commit is contained in:
parent
6f69d068d7
commit
8820636a35
2 changed files with 9 additions and 3 deletions
1
.github/workflows/docker-build-and-push.yml
vendored
1
.github/workflows/docker-build-and-push.yml
vendored
|
@ -241,6 +241,7 @@ jobs:
|
|||
run: npm run test:e2e
|
||||
env:
|
||||
CI: true
|
||||
DEBUG: testcontainers:containers
|
||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||
PAPERLESS_GPT_IMAGE: ${{ env.PAPERLESS_GPT_IMAGE }}
|
||||
- name: Upload Playwright Report
|
||||
|
|
11
main.go
11
main.go
|
@ -168,9 +168,14 @@ func main() {
|
|||
VisionLLMModel: visionLlmModel,
|
||||
}
|
||||
|
||||
ocrProvider, err = ocr.NewProvider(ocrConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to initialize OCR provider: %v", err)
|
||||
// If provider is LLM, but no VISION_LLM_PROVIDER is set, don't initialize OCR provider
|
||||
if providerType == "llm" && visionLlmProvider == "" {
|
||||
log.Warn("OCR provider is set to LLM, but no VISION_LLM_PROVIDER is set. Disabling OCR.")
|
||||
} else {
|
||||
ocrProvider, err = ocr.NewProvider(ocrConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to initialize OCR provider: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize App with dependencies
|
||||
|
|
Loading…
Reference in a new issue