fix: improve llmwiki search integration

This commit is contained in:
Administrator committed 2026-08-13 16:03:08 +08:00
1 parent 4809ee7db3
commit 56044d9cb7
20 files changed
+504 -66

No files matched your search

@@ -101,9 +101,9 @@ def _agent_bound_ids(body: Any) -> list[str]:
def resolve_requested_llmwiki_knowledge_base_ids(body: Any) -> list[str]:
"""Return selected ids plus custom-agent defaults, de-duplicated in order."""
"""Return knowledge bases explicitly selected for the current conversation."""
return list(dict.fromkeys([*_agent_bound_ids(body), *_body_selected_ids(body)]))
return _body_selected_ids(body)
def llmwiki_selection_requested(body: Any) -> bool:
@@ -1045,6 +1045,10 @@ async def start_run(
body_context["rag_mode_enabled"] = True
if "llmwiki_knowledge_base_ids" not in body_context and llmwiki_rag.knowledge_base_ids:
body_context["llmwiki_knowledge_base_ids"] = llmwiki_rag.knowledge_base_ids
if not llmwiki_rag.knowledge_base_ids:
existing_excluded = list(body_context.get("excluded_tools") or getattr(body, "excluded_tools", None) or [])
if "llmwiki_search" not in existing_excluded:
body_context["excluded_tools"] = [*existing_excluded, "llmwiki_search"]
# Promote whitelisted top-level body fields into the context map so
# callers can pass them either nested under ``context`` or as flat
# top-level fields (``excluded_tools``, ``skill_stop_names``, …).