📝 Add docstrings to limit-pages-ocr

Docstrings generation was requested by @icereed.

* https://github.com/icereed/paperless-gpt/pull/102#issuecomment-2582999315

The following files were modified:

* `main.go`
* `paperless_test.go`
This commit is contained in:
coderabbitai[bot] 2025-01-10 16:02:32 +00:00 committed by GitHub
parent ebc26b5bdf
commit ea97e3b660
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -262,7 +262,7 @@ func isOcrEnabled() bool {
return visionLlmModel != "" && visionLlmProvider != ""
}
// validateOrDefaultEnvVars ensures all necessary environment variables are set
// validateOrDefaultEnvVars validates and sets default values for environment variables required by the application. It ensures that necessary configuration parameters are present and sets sensible defaults where possible. The function checks and configures tags for manual and automatic document processing, validates Paperless URL and API token, verifies LLM provider and model settings, and handles OCR page limit configuration. If any critical environment variables are missing, the function will terminate the application with a fatal error.
func validateOrDefaultEnvVars() {
if manualTag == "" {
manualTag = "paperless-gpt"

View file

@ -363,7 +363,7 @@ func TestUrlEncode(t *testing.T) {
assert.Equal(t, expected, result)
}
// TestDownloadDocumentAsImages tests the DownloadDocumentAsImages method
// 4. The image file is successfully created on the filesystem
func TestDownloadDocumentAsImages(t *testing.T) {
env := newTestEnv(t)
defer env.teardown()
@ -398,6 +398,9 @@ func TestDownloadDocumentAsImages(t *testing.T) {
}
}
// TestDownloadDocumentAsImages_ManyPages tests the DownloadDocumentAsImages method for a multi-page PDF document with a specified page limit.
// It verifies that the method correctly extracts a limited number of pages from a PDF, generates image files, and returns the correct image paths.
// The test ensures that exactly 50 pages are extracted from a 52-page document and that the image files are created in the expected location.
func TestDownloadDocumentAsImages_ManyPages(t *testing.T) {
env := newTestEnv(t)
defer env.teardown()