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>
This commit is contained in:
@@ -19,9 +19,12 @@ const appGlobals = {
|
||||
S: 'writable',
|
||||
_plugins: 'writable',
|
||||
_batchState: 'writable',
|
||||
_batchPollTimer: 'writable',
|
||||
_batchWs: 'writable',
|
||||
_bnd: 'writable',
|
||||
_photoQueue: 'writable',
|
||||
_aiBlocksVisible: 'writable',
|
||||
_aiLog: 'writable',
|
||||
_aiLogWs: 'writable',
|
||||
|
||||
// helpers.js
|
||||
esc: 'readonly',
|
||||
@@ -46,6 +49,7 @@ const appGlobals = {
|
||||
isLoading: 'readonly',
|
||||
vPluginBtn: 'readonly',
|
||||
vBatchBtn: 'readonly',
|
||||
vAiIndicator: 'readonly',
|
||||
candidateSugRows: 'readonly',
|
||||
_STATUS_BADGE: 'readonly',
|
||||
getBookStats: 'readonly',
|
||||
@@ -56,6 +60,7 @@ const appGlobals = {
|
||||
|
||||
// detail-render.js
|
||||
vDetailBody: 'readonly',
|
||||
aiBlocksShown: 'readonly',
|
||||
|
||||
// canvas-crop.js
|
||||
startCropMode: 'readonly',
|
||||
@@ -72,7 +77,8 @@ const appGlobals = {
|
||||
// init.js
|
||||
render: 'readonly',
|
||||
renderDetail: 'readonly',
|
||||
startBatchPolling: 'readonly',
|
||||
connectBatchWs: 'readonly',
|
||||
connectAiLogWs: 'readonly',
|
||||
loadTree: 'readonly',
|
||||
|
||||
// CDN (SortableJS loaded via <script> in index.html)
|
||||
@@ -96,8 +102,15 @@ export default [
|
||||
// Catch typos and missing globals
|
||||
'no-undef': 'error',
|
||||
|
||||
// builtinGlobals:false — only catch intra-file re-declarations, not globals
|
||||
// from appGlobals which are intentionally re-defined in their owning file.
|
||||
'no-redeclare': ['error', { builtinGlobals: false }],
|
||||
|
||||
// Unused variables: allow leading-underscore convention for intentional ignores
|
||||
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
||||
],
|
||||
|
||||
// Require strict equality
|
||||
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
||||
|
||||
Reference in New Issue
Block a user