mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Search inside documents: PDF text, Tesseract OCR for scans (in the image), optional Claude; nightly catch-up
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2953b9a18d
commit
08ba017c7e
14 files changed
+271
-6
No files matched your search
@@ -31,6 +31,12 @@ class Document < ApplicationRecord
|
||||
def to_s = name
|
||||
def type_label = TYPES[doc_type]
|
||||
def expired?(today = Date.current) = expires_on.present? && today > expires_on
|
||||
|
||||
# The page files the search text was read from; when they change, it's read again.
|
||||
def pages_source_key = pages.map(&:blob_id).sort.join(",")
|
||||
def pages_text_stale? = pages_text_source.to_s != pages_source_key
|
||||
|
||||
after_commit(on: %i[create update]) { DocumentTextJob.perform_later(id) if pages.attached? && pages_text_stale? }
|
||||
def expiry_warning_days = EXPIRY_WARNING_DAYS.fetch(doc_type, 30)
|
||||
|
||||
# nil visibility inherits from the collection; uncollected docs default to private.
|
||||
|
||||
@@ -9,6 +9,7 @@ class Setting < ApplicationRecord
|
||||
"max_upload_mb" => { default: 50, in: 1..1024, label: "Maximum upload size (MB)" },
|
||||
"backups_kept" => { default: 14, in: 1..365, label: "Database backups kept" },
|
||||
"offsite_backups_kept" => { default: 30, in: 1..365, label: "Database copies kept in Google Drive" },
|
||||
"documents_claude_text" => { default: 0, in: 0..1, label: "Read scanned documents with Claude" },
|
||||
"logbook_templates_seeded" => { default: 0, in: 0..1, label: "Built-in logbook templates added" } # internal flag
|
||||
}.freeze
|
||||
|
||||
|
||||
Reference in new issue
Block a user