fix(v2): botBrowser refuses a negative volume level

level=-10 was read as 10 (the sign was dropped) and unmuted the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-19 01:02:01 +09:00
parent 912b3304ac
commit 218e7734be
3 changed files with 7 additions and 5 deletions

View File

@@ -479,8 +479,8 @@ class BotBrowserTool(Tool):
elif action == "back":
call = lambda s: s.back()
elif action == "volume":
m = re.search(r"\d+(?:\.\d+)?", str(args.get("level") if args.get("level") is not None else ""))
if not m:
m = re.search(r"-?\d+(?:\.\d+)?", str(args.get("level") if args.get("level") is not None else ""))
if not m or float(m.group()) < 0:
return _fail("volume needs a level from 0 to 100")
level = min(100, round(float(m.group())))
call = lambda s: s.volume(level)