Skip to content

feat(zotero): multi-library support + empty-content-skip - #1

Merged
psuckrow-routine merged 5 commits into
mainfrom
feat/multi-library-zotero
Sep 1, 2026
Merged

psuckrow-routine merged 5 commits into
mainfrom
feat/multi-library-zotero

Conversation

@psuckrow-routine

Copy link
Copy Markdown
Collaborator

Continued from open-webui#93 — moved into the routinelabs org for compliance.

Summary

Three commits (unchanged from open-webui#93):

  • feat(zotero): support multiple libraries via per-source library ID — parses zotero:<library_id>: source URIs so one daemon can sync multiple Zotero libraries into different Knowledge Bases.
  • refactor(zotero): per-library env var resolution via _zotero_env helper — looks up ZOTERO_API_KEY_<library_id>, ZOTERO_LIBRARY_TYPE_<library_id>, etc., falling back to the unsuffixed defaults.
  • fix(sync): skip empty file content before upload — avoids sending zero-byte payloads to Open WebUI that would create orphaned file rows.

Context

Pinned in downstream via pip install git+https://github.com/routinelabs/oikb@8c38d57 (Dockerfile.oikb). Both routinelabs clients today rely on this fork for multi-library and empty-content-skip behavior.

Upstream

Upstream PR still open at open-webui#93 for eventual merge back — this internal PR exists so we can iterate + carry the fork in-house without depending on the upstream review cadence.

Pierre-Louis Suckrow and others added 3 commits August 3, 2026 10:46
Embed an optional numeric library ID in the source string to allow
multiple Zotero libraries to be synced from a single daemon instance:

  source: "zotero:123456:"              # all collections in library 123456
  source: "zotero:123456:Research%%ML"  # specific collection

When a library ID is present the connector resolves credentials from
per-library env vars before falling back to the global defaults:

  ZOTERO_API_KEY_<library_id>      → ZOTERO_API_KEY
  ZOTERO_LIBRARY_TYPE_<library_id> → ZOTERO_LIBRARY_TYPE

Existing source strings ("zotero:" or "zotero:Collection%%Sub") are
fully backward-compatible — collection names are not purely numeric so
there is no ambiguity when parsing.
Introduce _zotero_env(key, library_id, default) which checks
ZOTERO_<KEY>_<library_id> before falling back to ZOTERO_<KEY>. Apply
it uniformly to every configurable setting so that each source entry
in .oikb.yaml can be tuned independently when multiple libraries are
in use:

  ZOTERO_CHECKSUM_<id>              overrides  ZOTERO_CHECKSUM
  ZOTERO_INCLUDE_NOTES_<id>                    ZOTERO_INCLUDE_NOTES
  ZOTERO_INCLUDE_ANNOTATIONS_<id>              ZOTERO_INCLUDE_ANNOTATIONS
  ZOTERO_LIBRARY_TYPE_<id>                     ZOTERO_LIBRARY_TYPE
  ZOTERO_EXCLUDE_<id>                          ZOTERO_EXCLUDE
  ZOTERO_UNFILED_DIR_<id>                      ZOTERO_UNFILED_DIR
  ZOTERO_WEBDAV_{URL,USER,PASSWORD}_<id>       ZOTERO_WEBDAV_*

Single-library setups are unaffected — the helper falls through to the
global vars unchanged.
Files with no extractable text (e.g. Zotero items with no fulltext and
no downloadable PDF) were uploaded as zero-byte payloads, causing
Open WebUI to reject them with EMPTY_CONTENT errors on every sync cycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@psuckrow-routine

Copy link
Copy Markdown
Collaborator Author

Also cherry-picked upstream open-webui#109 (@naamval — selective Zotero collection sync fix) onto this branch:

  • 1693f5b fix Zotero sync specific collections
  • 7a6f300 Add missing comment

Attribution preserved via cherry-pick.

@psuckrow-routine
psuckrow-routine force-pushed the feat/multi-library-zotero branch from 1693f5b to 3decf23 Compare September 1, 2026 15:47
@psuckrow-routine
psuckrow-routine merged commit d0d1e37 into main Sep 1, 2026
@psuckrow-routine
psuckrow-routine deleted the feat/multi-library-zotero branch September 1, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant