Fix ValueError when no knowledge base is attached
_build_kb_mcp_server() returns a 3-tuple (server, tool_names,
tools_by_name) on its normal path, and all three call sites unpack
three values. But the early return for the "no KB attached" case still
returned a 2-tuple (None, []), so every message sent without a knowledge
base attached raised:
ValueError: not enough values to unpack (expected 3, got 2)
Return (None, [], {}) instead, and update the docstring to match.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5bbc1fcdf9
commit
e495c963b5
|
|
@ -369,8 +369,8 @@ def _build_kb_mcp_server(
|
|||
user_dict: Optional[Dict[str, Any]] = None,
|
||||
event_emitter: Optional[Callable] = None,
|
||||
):
|
||||
"""Return (mcp_config, tool_names) for a knowledge-base search tool Claude
|
||||
can invoke, or (None, []) if no KBs are attached.
|
||||
"""Return (mcp_config, tool_names, tools_by_name) for a knowledge-base
|
||||
search tool Claude can invoke, or (None, [], {}) if no KBs are attached.
|
||||
|
||||
Result formatting follows OpenWebUI's native RAG shape (<source id=N ...>
|
||||
tags + citation event), so Claude's replies render with inline [N]
|
||||
|
|
@ -379,7 +379,7 @@ def _build_kb_mcp_server(
|
|||
that OpenWebUI's middleware already filtered by the user's grants.
|
||||
"""
|
||||
if not knowledge:
|
||||
return None, []
|
||||
return None, [], {}
|
||||
|
||||
collection_names = [k["id"] for k in knowledge]
|
||||
display = ", ".join(k["name"] for k in knowledge)
|
||||
|
|
|
|||
Loading…
Reference in New Issue