fix(smb): ingest as File source so docs appear in default chat; update UI patch
The Ingestion API docs require creating a connector with source=file and pushing documents with from_ingestion_api=true so they are indexed under a recognizable DocumentSource that Onyx's chat UI can filter and search. Previously we used source=ingestion_api / input_type=poll. Documents were indexed (visible in the admin panel) but were not searchable in Onyx's default chat because ingestion_api is absent from the chat filter UI. Connector changes: - onyx_client.py: create connector as source=file, input_type=load_state, connector_specific_config.file_locations=[] (avoids LocalFileConnector health-check errors since we push via API, not disk crawl) - sync.py: set source=file and from_ingestion_api=true on every document and index payload so Onyx treats them as API-ingested File docs UI overlay changes (branding/smb/smb-ui.patch): - Replace document.source_type === ValidSources.IngestionApi with document.metadata?.smb_source - This keeps the broken-preview suppression and logical-path clipboard copy working for SMB docs, while leaving normal File uploads untouched Result: SMB documents now surface in default chat under the File filter, the connector stays "Up to Date" without dummy-file errors, and the Phase 2 click-to-copy behavior continues to work.
This commit is contained in:
parent
26d3262cfb
commit
d4cb8dcb99
3 changed files with 11 additions and 7 deletions
|
|
@ -37,7 +37,7 @@ index 42fb3bd8..5ee25228 100644
|
|||
+ // browsable link and no stored file to preview — the preview pane would just
|
||||
+ // fail. Copy the logical path to the clipboard so the user can open the file
|
||||
+ // directly on the share. Mirrors openDocument() used by the chat view.
|
||||
+ if (document.source_type === ValidSources.IngestionApi) {
|
||||
+ if (document.from_ingestion_api || document.metadata?.smb_source) {
|
||||
+ // The full network path is in metadata.logical_path (the search result does
|
||||
+ // not always carry `link`); semantic_identifier is only the file name.
|
||||
+ const logicalPath = document.metadata?.logical_path;
|
||||
|
|
@ -76,7 +76,7 @@ index ce7eab36..6e4baff3 100644
|
|||
+ // 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.source_type === ValidSources.IngestionApi) {
|
||||
+ if (document.from_ingestion_api || 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.
|
||||
+ const path =
|
||||
|
|
|
|||
|
|
@ -167,9 +167,11 @@ class OnyxClient:
|
|||
groups = group_ids or []
|
||||
connector = {
|
||||
"name": name,
|
||||
"source": "ingestion_api",
|
||||
"input_type": "poll",
|
||||
"connector_specific_config": {},
|
||||
"source": "file",
|
||||
"input_type": "load_state",
|
||||
"connector_specific_config": {
|
||||
"file_locations": []
|
||||
},
|
||||
"refresh_freq": None,
|
||||
"prune_freq": None,
|
||||
"indexing_start": None,
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ def _build_document(
|
|||
updated = datetime.fromtimestamp(mtime, tz=timezone.utc).isoformat()
|
||||
return {
|
||||
"id": doc_id,
|
||||
"source": "ingestion_api",
|
||||
"source": "file",
|
||||
# semantic_identifier is the label Onyx shows in the citation view. Use the
|
||||
# file name so the citation stays short; the full network path is still in
|
||||
# `link` and metadata, and the UI overlay copies it on click.
|
||||
|
|
@ -113,6 +113,7 @@ def _build_document(
|
|||
"relative_path": rel_path,
|
||||
},
|
||||
"doc_updated_at": updated,
|
||||
"from_ingestion_api": True,
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -152,7 +153,7 @@ def _build_index_document(source: SourceConfig, files: dict[str, "FileRecord"])
|
|||
label = f"{source.name} — Index ({len(files)} Dateien)"
|
||||
return {
|
||||
"id": _index_document_id(source.name),
|
||||
"source": "ingestion_api",
|
||||
"source": "file",
|
||||
"semantic_identifier": label,
|
||||
"title": label,
|
||||
# No file:// link: the index is a generated document, not a file on the
|
||||
|
|
@ -164,6 +165,7 @@ def _build_index_document(source: SourceConfig, files: dict[str, "FileRecord"])
|
|||
"smb_index": "true",
|
||||
},
|
||||
"doc_updated_at": datetime.now(tz=timezone.utc).isoformat(),
|
||||
"from_ingestion_api": True,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue