mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-08-01 10:56:02 +00:00
fix browser extra detection for indentless YAML (#4367)
This commit is contained in:
parent
b5cc3a81c3
commit
183280ebfc
@ -157,6 +157,14 @@ def test_detect_from_config_browser_via_browser_navigate_tool(tmp_path):
|
|||||||
assert detect.detect_from_config(cfg) == ["browser"]
|
assert detect.detect_from_config(cfg) == ["browser"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_detect_from_config_browser_via_indentless_tools_list(tmp_path):
|
||||||
|
cfg = tmp_path / "config.yaml"
|
||||||
|
cfg.write_text(
|
||||||
|
"tools:\n- name: web_fetch\n group: web\n- name: browser_navigate\n group: browser\n",
|
||||||
|
)
|
||||||
|
assert detect.detect_from_config(cfg) == ["browser"]
|
||||||
|
|
||||||
|
|
||||||
def test_detect_from_config_ignores_commented_browser_tool(tmp_path):
|
def test_detect_from_config_ignores_commented_browser_tool(tmp_path):
|
||||||
cfg = tmp_path / "config.yaml"
|
cfg = tmp_path / "config.yaml"
|
||||||
cfg.write_text(
|
cfg.write_text(
|
||||||
|
|||||||
@ -237,14 +237,16 @@ def tools_include_name(lines: list[str], tool_name: str) -> bool:
|
|||||||
continue
|
continue
|
||||||
if not inside:
|
if not inside:
|
||||||
continue
|
continue
|
||||||
|
name_match = _LIST_ITEM_NAME_RE.match(line)
|
||||||
|
if name_match:
|
||||||
|
if _unquote(name_match.group(1).strip()) == tool_name:
|
||||||
|
return True
|
||||||
|
continue
|
||||||
stripped = line.lstrip()
|
stripped = line.lstrip()
|
||||||
indent = len(line) - len(stripped)
|
indent = len(line) - len(stripped)
|
||||||
if indent == 0:
|
if indent == 0:
|
||||||
inside = False
|
inside = False
|
||||||
continue
|
continue
|
||||||
name_match = _LIST_ITEM_NAME_RE.match(line)
|
|
||||||
if name_match and _unquote(name_match.group(1).strip()) == tool_name:
|
|
||||||
return True
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user