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
@@ -12,8 +12,8 @@ from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
||||
|
||||
from deerflow.persistence.base import Base
|
||||
from deerflow.persistence.compact_menu_overrides import (
|
||||
MemoryCompactMenuOverrideStore,
|
||||
CompactMenuOverrideRepository,
|
||||
MemoryCompactMenuOverrideStore,
|
||||
normalize_compact_menu_type,
|
||||
)
|
||||
from deerflow.persistence.compact_menu_overrides.keys import public_node_id, storage_node_id
|
||||
@@ -53,15 +53,17 @@ async def test_replace_all_roundtrips(store: CompactMenuOverrideRepository):
|
||||
[
|
||||
{"node_id": "workspace-chats", "placement": "settings", "sort_order": 1, "label": "会话"},
|
||||
{"node_id": "workspace-agents", "placement": "sidebar", "sort_order": 0, "label": None},
|
||||
{"node_id": "workspace-skills", "placement": "toolbox", "sort_order": 0, "label": "技能工具"},
|
||||
],
|
||||
updated_by="admin-1",
|
||||
)
|
||||
assert len(out) == 2
|
||||
assert len(out) == 3
|
||||
rows = {r["node_id"]: r for r in await store.list_overrides()}
|
||||
assert rows["workspace-chats"]["label"] == "会话"
|
||||
assert rows["workspace-chats"]["placement"] == "settings"
|
||||
assert rows["workspace-chats"]["menu_type"] == "A"
|
||||
assert rows["workspace-agents"]["updated_by"] == "admin-1"
|
||||
assert rows["workspace-skills"]["placement"] == "toolbox"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -56,6 +56,13 @@ async def test_exact_search_groups_sections_by_wiki_page_and_filters_drafts() ->
|
||||
with_drafts = await service.search("alice", [mapping], include_drafts=True)
|
||||
assert {item["wiki_slug"] for item in with_drafts["results"]} == {"alice", "secret"}
|
||||
|
||||
section_result = await service.search_sections("alice", [mapping], top_k_sections=2, external=True)
|
||||
assert [item["content"] for item in section_result["results"]] == ["Alpha", "Beta"]
|
||||
assert all(item["wiki_slug"] == "alice" for item in section_result["results"])
|
||||
assert all(item["kind"] == "wiki_section" for item in section_result["results"])
|
||||
assert section_result["results"][0]["wiki_page_id"]
|
||||
assert "page_content" in section_result["results"][0]
|
||||
|
||||
narrow_service = WikiVectorSearchService(
|
||||
LocalWikiIndexConfig(min_similarity=0, top_k_sections=1, top_k_pages=1),
|
||||
FakeEmbedding(),
|
||||
|
||||
@@ -1379,7 +1379,9 @@ def test_weknora_iframe_html_rewrites_public_prefix_paths() -> None:
|
||||
assert "function protectedImageApiUrl" in injected
|
||||
assert 'img[data-protected-src]' in injected
|
||||
assert 'encodeURIComponent(cfg.weknoraId)' in injected
|
||||
assert 'credentials: "same-origin"' in injected
|
||||
assert "image.src = proxyUrl;" in injected
|
||||
assert "URL.createObjectURL(blob)" not in injected
|
||||
assert 'attributeFilter: ["data-protected-src", "src"]' in injected
|
||||
|
||||
|
||||
def test_weknora_iframe_filters_kb_list_to_signed_visible_mappings() -> None:
|
||||
|
||||
Reference in new issue
Block a user