feat: add compact toolbox and public wiki vector search
This commit is contained in:
1 parent
9f29ecae9e
commit
d35d075669
29 files changed
+757
-128
No files matched your search
@@ -1024,10 +1024,14 @@ Both can be modified at runtime via Gateway API endpoints or `DeerFlowClient` me
|
||||
|
||||
The embedded detail proxy hides WeKnora's outer `.main > .aside_box` application sidebar and expands the route outlet, but deliberately keeps the Wiki page's internal directory/index sidebar. Do not add an HTML `sandbox` attribute to this trusted, permission-filtered detail iframe: a sandboxed ancestor causes Chromium's built-in Blob PDF viewer to render the browser-blocked page. The Gateway follows upstream redirects only for `/knowledge/{id}/preview` and `/knowledge-bases/{id}/files`, keeping PDF bytes and protected Wiki images inside the signed proxy instead of sending the browser to WeKnora object storage.
|
||||
Native/private and public Wiki readers must rewrite protected Markdown image
|
||||
sources to their mapping-scoped DeerFlow `/files?file_path=` endpoints and load
|
||||
them as Blob URLs. The embedded guard also rewrites protected fetch/XHR values
|
||||
and hydrates late `img[data-protected-src]` placeholders; never expose the
|
||||
service token or relax the current-KB authorization to make images work.
|
||||
sources to their mapping-scoped DeerFlow `/files?file_path=` endpoints and keep
|
||||
real HTTP URLs on rendered image elements. The embedded guard also rewrites
|
||||
protected fetch/XHR values and hydrates late `img[data-protected-src]`
|
||||
placeholders with the signed iframe HTTP proxy URL. Observe both
|
||||
`data-protected-src` and `src`, because WeKnora may replace the URL after first
|
||||
paint. Never create/revoke a temporary object URL here: its lightbox reuses the
|
||||
thumbnail `src` after click. Never expose the service token or relax the
|
||||
current-KB authorization to make images work.
|
||||
|
||||
**Embedded native knowledge-base switching:** The original WeKnora breadcrumb picker remains available inside the detail iframe. A signed 15-minute embed cookie carries only the current DeerFlow user's visible mappings (their own plus published bases); the proxied `/api/v1/knowledge-bases` response is filtered to that allowlist. Choosing another entry performs a full iframe navigation, rechecks the DeerFlow mapping and read/write permission, then reissues the cookie for the selected base. Never expose the upstream service-admin list directly or permit an arbitrary remote knowledge-base ID.
|
||||
|
||||
@@ -1509,7 +1513,10 @@ authenticated readers obtain a short-lived signed capability from
|
||||
`/files/access-url` and load `/api/public/llmwiki/files/{token}`. The signed
|
||||
payload is restricted to `kind=wiki_file`, mapping id, remote id, validated
|
||||
protected path, and expiry, and responses provide an inline UTF-8 filename for
|
||||
new-tab viewing and browser Save As.
|
||||
new-tab viewing and browser Save As. The proxied WeKnora detail iframe must
|
||||
likewise leave its scoped HTTP file-proxy URL on every protected image and
|
||||
restore it if upstream rendering replaces `src`; its click preview reads that
|
||||
same DOM value, so a fetched-and-revoked object URL is not acceptable.
|
||||
|
||||
Third-party pages embed published Wiki content through the chrome-free route
|
||||
`/#/embed/knowledge/{mapping_id}` (optional exact-page `wikiSlug`). It defaults
|
||||
@@ -1558,11 +1565,26 @@ Internal search authorization always starts from DeerFlow mapping ids and is
|
||||
rechecked by the Gateway. External endpoints use the isolated
|
||||
`/api/external/llmwiki/wiki` namespace and `X-API-Key`; require published +
|
||||
external-enabled + index-enabled on every request and response, and hard-deny
|
||||
the `system` / `对话沉淀` mapping. Never return remote WeKnora ids, provenance
|
||||
refs, credentials, or vector bytes externally. Regression tests:
|
||||
the `system` / `对话沉淀` mapping. Those API-key endpoints never return remote
|
||||
WeKnora ids, provenance refs, credentials, or vector bytes.
|
||||
|
||||
`POST /api/knowledge/vector-search` is a deliberately separate anonymous API.
|
||||
It has no token/API-key requirement or rate limit, applies route-scoped
|
||||
`Access-Control-Allow-Origin: *`, searches every published local Wiki index
|
||||
regardless of `external_search_enabled`, and still hard-denies the `system` /
|
||||
`对话沉淀` mapping before and after search. Its contract is section-level (one
|
||||
result per matched vector, so Wiki-page fields and URLs may repeat), default
|
||||
`top_k=10`, with optional `include_page_content`. Unlike the protected legacy
|
||||
external namespace, this endpoint intentionally returns DeerFlow/WeKnora ids
|
||||
and raw source/chunk provenance, but never credentials or vector bytes. Wiki
|
||||
links use `llmwiki.local_wiki_index.frontend_base_url` (development default
|
||||
`http://127.0.0.1:5174`) and point to the native
|
||||
`/#/page/workspace/knowledge/{mapping_id}/wiki/view?wikiSlug=...` route.
|
||||
Regression tests:
|
||||
`tests/test_llmwiki_local_index_repository.py`,
|
||||
`tests/test_llmwiki_wiki_sync.py`, `tests/test_llmwiki_vector_search.py`,
|
||||
`tests/test_external_llmwiki_search.py`, and
|
||||
`tests/test_external_llmwiki_search.py`,
|
||||
`tests/test_public_knowledge_vector_search.py`, and
|
||||
`tests/test_llmwiki_wiki_retrieval.py`.
|
||||
|
||||
The sandbox whole-report rewrite may carry an optional `reportOutline` Markdown
|
||||
|
||||
Reference in new issue
Block a user