diff --git a/branding/branding.config.json b/branding/branding.config.json index 9c4770e..19cac21 100644 --- a/branding/branding.config.json +++ b/branding/branding.config.json @@ -9,11 +9,11 @@ "upstream": { "$comment": "Pin the exact Onyx release tag this overlay is authored against. `make setup` checks this out. Locked to a release NUMBER (e.g. v4.7.2), not a raw commit. As of v4.7.2 Onyx ships OFFICIAL i18n (next-intl, incl. German), so the temporary i18n backport is disabled (i18n.enabled=false) and the codemod rebrands Onyx->AIDO inside the official message catalogs instead. To move to a newer Onyx: re-sync the smbUi patch onto the new tag (targeted patches in apply-branding.mjs are string-based and usually survive), then bump this.", "repo": "https://github.com/onyx-dot-app/onyx", - "pinnedCommit": "v4.7.2", + "pinnedCommit": "v4.8.2", "webSrcRoot": "web" }, "i18n": { - "$comment": "DISABLED as of the v4.7.2 upgrade. This was a TEMPORARY end-user i18n backport of Onyx PR #12558 (react-i18next) used on v4.5.2 before Onyx shipped official i18n. v4.7.2 has official next-intl i18n (German included), so this whole overlay is off. Kept here only for reference/rollback; the patch and dictionaries are no longer applied. Language limiting to de+en and the codemod rebrand of the official catalogs are handled directly in apply-branding.mjs (steps 2b + 3c-official). Do not re-enable against v4.7+.", + "$comment": "DISABLED since the v4.7.2 upgrade. This was a TEMPORARY end-user i18n backport of Onyx PR #12558 (react-i18next) used on v4.5.2 before Onyx shipped official i18n. v4.7.2 has official next-intl i18n (German included), so this whole overlay is off. Kept here only for reference/rollback; the patch and dictionaries are no longer applied. Language limiting to de+en and the codemod rebrand of the official catalogs are handled directly in apply-branding.mjs (steps 2b + 3c-official). Do not re-enable against v4.7+. (Now pinned to v4.8.2.)", "enabled": false, "patch": "branding/i18n/end-user-i18n.patch", "baseCommit": "v4.5.2", @@ -28,7 +28,7 @@ "$dictionaries_comment": "Client-editable source dictionaries. After the patch is applied, apply-branding.mjs copies dictionaries/.json over web/public/locales//common.json — so edits here PERSIST across `make setup` (they're the source of truth, not the patch). Edit branding/i18n/locales/de.json to add/refine German (see MISSING-de.md for untranslated keys), then `make apply && make build`." }, "smbUi": { - "$comment": "Phase 2 of the SMB connector (smb-connector/): a tiny frontend overlay so documents synced from SMB/network shares (source=ingestion_api) don't present a broken, dead file-preview. Clicking a cited SMB document copies its logical network path (\\\\company\\share\\...) to the clipboard instead, so the user can open it on the share. The same patch also fixes the connector status badge (ingestion_api never runs the classic indexer, so it would stay stuck on 'Initial Indexing'). Applied before the branding codemod; re-synced onto v4.7.2. Independent of the connector itself; set enabled=false to drop it.", + "$comment": "SMB connector UI overlay (smb-connector/): a tiny frontend overlay so documents synced from SMB/network shares don't present a broken, dead file-preview. SMB documents are detected by metadata.smb_source (they are ingested as the `file` source, so they show in Default Chat and the source filters). Clicking a cited SMB document copies its full logical network path (\\\\company\\share\\...) from metadata.logical_path to the clipboard instead, so the user can open it on the share. Covers both the chat citation view and the licensed Search view. (The earlier 'Initial Indexing' badge fix was dropped: File connectors report status correctly on their own.) Applied before the branding codemod; re-synced onto v4.8.2. Independent of the connector itself; set enabled=false to drop it.", "enabled": true, "patch": "branding/smb/smb-ui.patch" }, diff --git a/branding/smb/smb-ui.patch b/branding/smb/smb-ui.patch index fdf1f06..cec539f 100644 --- a/branding/smb/smb-ui.patch +++ b/branding/smb/smb-ui.patch @@ -1,24 +1,5 @@ -diff --git a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx -index 0f61ede9..2dcb8e7e 100644 ---- a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx -+++ b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx -@@ -179,7 +179,13 @@ function ConnectorRow({ - - void ) => { -+ // AIDO: documents synced from SMB/network shares (ingestion API) have no -+ // browsable link and no stored file to preview — a normal preview click would -+ // just fail. Instead, surface the logical path by copying it to the clipboard -+ // so the user can open the file directly on the share. ++ // AIDO: documents synced from SMB/network shares have no browsable link and no ++ // stored file to preview — a normal preview click would just fail. Instead, ++ // surface the logical path by copying it to the clipboard so the user can open ++ // the file directly on the share. + if (document.metadata?.smb_source) { + // The full network path is in metadata.logical_path (the citation object + // does not always carry `link`); semantic_identifier is only the file name. diff --git a/smb-connector/README.md b/smb-connector/README.md index a8c4cc4..49ec4cb 100644 --- a/smb-connector/README.md +++ b/smb-connector/README.md @@ -1,21 +1,30 @@ -# AIDO SMB → Onyx Connector (Phase 1) +# AIDO SMB → Onyx Connector Syncs files from one or more **SMB/CIFS shares** into Onyx via the public -**Ingestion API**, with full production behaviour the POC was missing: +**Ingestion API**: - **Update & delete sync** — changed files are re-indexed in place; files removed from a share are deleted from Onyx (reconciled every cycle). -- **Self-provisioning** — creates/reuses the Onyx **API key** and one **connector - (cc_pair)** per source automatically; idempotent across restarts. +- **Self-provisioning** — creates/reuses the Onyx **API key** and one **File + connector (cc_pair)** per source automatically; idempotent across restarts. + Documents are pushed in as the `file` source, so they are searchable in Default + Chat and appear in the source filters like any other connector. - **Multi-source via Docker config** — any number of shares, defined purely in env. - **Logical path mapping** — each document is labelled with the path users recognise (`\\company\share\…`), mapped from the local mount via config. +- **Per-source index document** — an optional table-of-contents document per share + so the assistant is aware of the full document set (see `SMB_WRITE_INDEX`). +- **Per-connector group access** — restrict a connector to Onyx user groups (see + `SMB_SOURCE__GROUPS`). -It runs as a **sidecar container** and touches **no Onyx source code** — only the +It runs as its **own container** and touches **no Onyx source code** — only the public ingestion + admin APIs — so it survives Onyx upgrades. -> Phase 2 (separate) hides the broken file-preview for these SMB documents in the -> Onyx UI and shows the logical path instead, via the white-label overlay. +> A small white-label UI overlay (`branding/smb/smb-ui.patch`) improves how these +> documents behave in the Onyx UI: the citation shows the short file name, and a +> click copies the full network path to the clipboard instead of opening a dead +> preview (SMB files have no browsable link). This applies to both the chat +> citation view and the licensed Search view. ## How it works @@ -105,7 +114,7 @@ CIFS-mounted a second time — `_MOUNT` then just points at the bind-mounted pat | `SMB_SOURCE__UNC` (or `_SERVER`+`_SHARE`) | In-container CIFS mount: the share to mount at `_MOUNT` | | `SMB_SOURCE__USERNAME/_PASSWORD/_DOMAIN/_VERS` | CIFS credentials + dialect (default `3.0`); omit user for guest | | `INGESTION_INTERVAL_SECONDS` | Reconcile interval (default 300) | -| `INCLUDE_EXTENSIONS` | File types to ingest (default pdf,docx,txt,md,csv,xlsx,html) | +| `INCLUDE_EXTENSIONS` | File types to ingest. Default covers office + web + many text/IT formats (pdf, docx, xlsx, csv, txt, md, html, plus yaml, json, xml, ini, conf, cfg, sh, bash, ps1, py, sql, log, dockerfile, properties, toml, rst, mjs, patch, tsx) | | `MAX_FILE_MB` | Skip files larger than this (default 50) | | `SMB_WRITE_INDEX` | Write a per-source index (table-of-contents) document listing every file, so the assistant is aware of the full set (default on; `0`/`false` to disable) | | `SMB_SOURCE__GROUPS` | Onyx user-group ids (comma-separated) allowed to access this connector. Set → connector created **private** and restricted to those groups; empty → **public**. Applied only at connector creation. Needs the Onyx Business licence. In `SMB_SOURCES` JSON use `"groups": [id, …]`. | @@ -116,17 +125,23 @@ State (manifest + cached key/cc_pair) lives in the mounted `/app/state` volume. ## Notes / scope -- **Extraction** is the light set (PDF, DOCX, XLSX, CSV, TXT/MD, HTML). Legacy - `.doc`/`.xls` and scanned-image PDFs are skipped (no OCR) — Phase-1 scope. +- **Extraction** covers office, web, and common text/IT formats (see + `INCLUDE_EXTENSIONS`). Legacy `.doc`/`.xls` and scanned-image PDFs are skipped + (no OCR). Add or remove types via `INCLUDE_EXTENSIONS`. +- **Connector type**: documents are ingested as the `file` source (a first-class, + chat-searchable connector), so they appear in Default Chat and the source + filters. The connector is created once, then documents are pushed via the + Ingestion API (`from_ingestion_api`), not polled from a file location. - **Auth for provisioning**: creating the API key/connectors needs one admin credential the first time. At steady state only the cached API key is used. - **API-key auto-creation requires `LICENSE_ENFORCEMENT_ENABLED=false`** on the Onyx - deployment (verified against v4.5.2): the `/admin/api-key` endpoint is EE-tier-gated - and returns HTTP 402 when enforcement is on (the default). CE/white-label deployments - run with it off, so this is fine — and if you'd rather not rely on it, just supply a - pre-made `ONYX_API_KEY`. Connector/cc_pair creation and the ingestion API itself are + deployment: the `/admin/api-key` endpoint is EE-tier-gated and returns HTTP 402 + when enforcement is on (the default). CE/white-label deployments run with it off, + so this is fine — and if you'd rather not rely on it, just supply a pre-made + `ONYX_API_KEY`. Connector/cc_pair creation and the ingestion API itself are **not** tier-gated and work on plain CE. - **Document ids are URL-safe** (`smb__`), matching how Onyx stores/returns them, so update and delete reconcile reliably (verified end-to-end). -- **`smb://` links** can't open from a browser; the logical path is stored for - display (Phase 2 surfaces it in the UI and hides the dead preview). +- **`smb://` links** can't open from a browser; the full network path is stored in + the document metadata, and the UI overlay copies it to the clipboard on click + (see `branding/smb/smb-ui.patch`). diff --git a/smb-connector/app/onyx_client.py b/smb-connector/app/onyx_client.py index db66759..4ba5b88 100644 --- a/smb-connector/app/onyx_client.py +++ b/smb-connector/app/onyx_client.py @@ -1,6 +1,6 @@ """Thin, typed client for the Onyx public + admin APIs used by the connector. -Endpoints (verified against Onyx v4.5.2): +Endpoints (stable across Onyx v4.5–v4.8): POST /onyx-api/ingestion upsert a document (by DocumentBase.id) DELETE /onyx-api/ingestion/{document_id} remove a document entirely GET /onyx-api/connector-docs/{cc_pair_id} list docs for a cc_pair (reconcile) @@ -152,8 +152,13 @@ class OnyxClient: return None def provision_cc_pair(self, name: str, group_ids: list[int] | None = None) -> int: - """Create an ingestion-API connector + mock credential + cc_pair. Returns - the cc_pair id. Idempotent: reuses an existing one with the same name. + """Create a File connector + mock credential + cc_pair. Returns the + cc_pair id. Idempotent: reuses an existing one with the same name. + + The connector is a File connector (documents are pushed in via the + Ingestion API with from_ingestion_api=True). File is a first-class, + chat-searchable source, so the documents show up in Default Chat and + the source filters; the older ingestion_api source is hidden there. When ``group_ids`` is given, the connector is created PRIVATE and restricted to those Onyx user groups (needs the Business licence). @@ -170,7 +175,7 @@ class OnyxClient: "source": "file", "input_type": "load_state", "connector_specific_config": { - "file_locations": [] + "file_locations": [] }, "refresh_freq": None, "prune_freq": None, @@ -202,9 +207,9 @@ class OnyxClient: return int(cc) def set_cc_pair_active(self, cc_pair_id: int) -> None: - """Mark the cc_pair ACTIVE. Onyx never runs a classic index attempt for - ingestion-API connectors (docs are pushed via the API, not polled), so - without this they sit in SCHEDULED/INITIAL_INDEXING forever. Best-effort.""" + """Mark the cc_pair ACTIVE so the connector is enabled and its documents + are searchable. Documents are pushed via the Ingestion API rather than + polled from a file location. Best-effort.""" try: resp = self._request( "PUT", diff --git a/smb-connector/app/sync.py b/smb-connector/app/sync.py index 86be2d2..036df8b 100644 --- a/smb-connector/app/sync.py +++ b/smb-connector/app/sync.py @@ -104,7 +104,7 @@ def _build_document( "semantic_identifier": filename, "title": filename, # The full logical network path. smb://Z:\... won't open in a browser; the - # Phase 2 UI overlay copies this to the clipboard on click instead. + # AIDO UI overlay copies this to the clipboard on click instead. "link": f"file://{logical}", "sections": [{"text": text, "link": None}], "metadata": {