Files
bookshelf/config/functions.default.yaml
Petr Polezhaev b94f222c96 Add per-request AI logging, DB batch queue, WS entity updates, and UI polish
- log_thread.py: thread-safe ContextVar bridge so executor threads can log
  individual LLM calls and archive searches back to the event loop
- ai_log.py: init_thread_logging(), notify_entity_update(); WS now pushes
  entity_update messages when book data changes after any plugin or batch run
- batch.py: replace batch_pending.json with batch_queue SQLite table;
  run_batch_consumer() reads queue dynamically so new books can be added
  while batch is running; add_to_queue() deduplicates
- migrate.py: fix _migrate_v1 (clear-on-startup bug); add _migrate_v2 for
  batch_queue table
- _client.py / archive.py / identification.py: wrap each LLM API call and
  archive search with log_thread start/finish entries
- api.py: POST /api/batch returns {already_running, added}; notify_entity_update
  after identify pipeline
- models.default.yaml: strengthen ai_identify confidence-scoring instructions;
  warn against placeholder data
- detail-render.js: book log entries show clickable ID + spine thumbnail;
  book spine/title images open full-screen popup
- events.js: batch-start handles already_running+added; open-img-popup action
- init.js: entity_update WS handler; image popup close listeners
- overlays.css / index.html: full-screen image popup overlay
- eslint.config.js: add new globals; fix no-redeclare/no-unused-vars for
  multi-file global architecture; all lint errors resolved

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 12:10:54 +03:00

91 lines
2.5 KiB
YAML

# Function configurations — dict per category (not lists).
# AI functions reference a model from models.*.yaml.
# Archive functions specify a type and optional config dict.
# Keys within each category serve as plugin_id; must be unique across all categories.
# Override individual functions in functions.user.yaml.
functions:
# ── Boundary detection: image → {boundaries: [...], confidence: 0.x}
# ai_shelf_boundaries / ai_book_boundaries stored as {functionId: [fractions]} per entity.
boundary_detectors:
shelves: # key = plugin_id = target; runs on cabinet images
model: vl_detect_shelves
max_image_px: 1600
auto_queue: false
rate_limit_seconds: 0
timeout: 30
books: # key = plugin_id = target; runs on shelf images
model: vl_detect_books
max_image_px: 1600
auto_queue: false
rate_limit_seconds: 0
timeout: 30
# ── Text recognition: spine image → {raw_text, title, author, year, publisher, other}
text_recognizers:
recognize:
model: vl_recognize
max_image_px: 1600
auto_queue: true
rate_limit_seconds: 0
timeout: 30
# ── Book identification: VLM result + archive results → ranked identification blocks
# is_vlm: true means the model also receives the book's spine and title-page images.
book_identifiers:
identify:
model: ai_identify
confidence_threshold: 0.8
auto_queue: false
rate_limit_seconds: 0
timeout: 60
is_vlm: true
# ── Archive searchers: query → [{source, title, author, year, isbn, publisher}, ...]
archive_searchers:
openlibrary:
name: "OpenLibrary"
type: openlibrary
auto_queue: true
rate_limit_seconds: 5
timeout: 8
rsl:
name: "РГБ"
type: rsl
auto_queue: true
rate_limit_seconds: 5
timeout: 8
rusneb:
name: "НЭБ"
type: rusneb
auto_queue: true
rate_limit_seconds: 5
timeout: 8
alib_web:
name: "Alib (web)"
type: alib_web
auto_queue: false
rate_limit_seconds: 5
timeout: 8
nlr:
name: "НЛР"
type: sru_catalog
auto_queue: false
rate_limit_seconds: 5
timeout: 8
config:
url: "http://www.nlr.ru/search/query"
query_prefix: "title="
shpl:
# Endpoint currently returns HTTP 404; retained for future re-enablement.
name: "ШПИЛ"
type: shpl
auto_queue: false
rate_limit_seconds: 5
timeout: 8