fix: enable tool mode only if a server is selected (#8865)
* Enable tool mode only if a server is selected * Set tool mode as false when mcp server is cleared * Added bool to build config tool show
This commit is contained in:
parent
180a94a7f3
commit
1fdeefda1b
1 changed files with 5 additions and 2 deletions
|
|
@ -120,7 +120,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|||
info="Placeholder for the tool",
|
||||
value="",
|
||||
show=False,
|
||||
tool_mode=True,
|
||||
tool_mode=False,
|
||||
),
|
||||
]
|
||||
|
||||
|
|
@ -280,9 +280,12 @@ class MCPToolsComponent(ComponentWithCache):
|
|||
build_config["tool"]["options"] = []
|
||||
build_config["tool"]["value"] = ""
|
||||
build_config["tool"]["placeholder"] = ""
|
||||
build_config["tool_placeholder"]["tool_mode"] = False
|
||||
self.remove_non_default_keys(build_config)
|
||||
return build_config
|
||||
|
||||
build_config["tool_placeholder"]["tool_mode"] = True
|
||||
|
||||
current_server_name = field_value.get("name") if isinstance(field_value, dict) else field_value
|
||||
_last_selected_server = self._shared_component_cache.get("last_selected_server") or ""
|
||||
|
||||
|
|
@ -329,7 +332,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|||
|
||||
elif field_name == "tool_mode":
|
||||
build_config["tool"]["placeholder"] = ""
|
||||
build_config["tool"]["show"] = not field_value
|
||||
build_config["tool"]["show"] = not bool(field_value) and bool(build_config["mcp_server"])
|
||||
self.remove_non_default_keys(build_config)
|
||||
self.tool = build_config["tool"]["value"]
|
||||
if field_value:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue