From d144ee76d942c9594d12508f3dfbcb90b988f0ce Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 4 Mar 2026 11:45:54 +0300 Subject: [PATCH] Chore: pw tools to be disabled as default --- bot.go | 2 +- config.example.toml | 4 ++-- config/config.go | 4 ++-- docs/config.md | 9 +++++++++ tools.go | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bot.go b/bot.go index d1f4eaa..13ee074 100644 --- a/bot.go +++ b/bot.go @@ -1524,7 +1524,7 @@ func init() { if cfg.STT_ENABLED { asr = NewSTT(logger, cfg) } - if !cfg.NoPlaywright { + if cfg.PlaywrightEnabled { if err := checkPlaywright(); err != nil { // slow, need a faster check if playwright install if err := installPW(); err != nil { diff --git a/config.example.toml b/config.example.toml index 7df35d9..39a730b 100644 --- a/config.example.toml +++ b/config.example.toml @@ -56,6 +56,6 @@ StripThinkingFromAPI = true # Strip blocks from messages before sending # Valid values: xhigh, high, medium, low, minimal, none (empty or none = disabled) # Models that support reasoning will include thinking content wrapped in tags ReasoningEffort = "medium" -# playwright -NoPlaywright = false +# playwright tools +PlaywrightEnabled = false PlaywrightDebug = false diff --git a/config/config.go b/config/config.go index e812fb8..412eaaa 100644 --- a/config/config.go +++ b/config/config.go @@ -71,8 +71,8 @@ type Config struct { CharSpecificContextTag string `toml:"CharSpecificContextTag"` AutoTurn bool `toml:"AutoTurn"` // playwright browser - NoPlaywright bool `toml:"NoPlaywright"` // when we want to avoid pw tool use - PlaywrightDebug bool `toml:"PlaywrightDebug"` // !headless + PlaywrightEnabled bool `toml:"PlaywrightEnabled"` + PlaywrightDebug bool `toml:"PlaywrightDebug"` // !headless } func LoadConfig(fn string) (*Config, error) { diff --git a/docs/config.md b/docs/config.md index 8f8c497..d8b42d6 100644 --- a/docs/config.md +++ b/docs/config.md @@ -162,6 +162,15 @@ Those could be switched in program, but also bould be setup in config. #### ToolUse - Enable or disable explanation of tools to llm, so it could use them. +#### Playwright Browser Automation +These settings enable browser automation tools available to the LLM. + +- **PlaywrightEnabled** (`false`) + - Enable or disable Playwright browser automation tools for the LLM. When enabled, the LLM can use tools like `pw_browser`, `pw_close`, and `pw_status` to automate browser interactions. + +- **PlaywrightDebug** (`false`) + - Enable debug mode for Playwright browser. When set to `true`, the browser runs in visible (non-headless) mode, displaying the GUI for debugging purposes. When `false`, the browser runs in headless mode by default. + ### StripThinkingFromAPI (`true`) - Strip thinking blocks from messages before sending to LLM. Keeps them in chat history for local viewing but reduces token usage in API calls. diff --git a/tools.go b/tools.go index 8cca673..3e5d402 100644 --- a/tools.go +++ b/tools.go @@ -1505,7 +1505,7 @@ func registerWindowTools() { func registerPlaywrightTools() { removePlaywrightToolsFromBaseTools() - if cfg != nil && !cfg.NoPlaywright { + if cfg != nil && cfg.PlaywrightEnabled { fnMap["pw_start"] = pwStart fnMap["pw_stop"] = pwStop fnMap["pw_is_running"] = pwIsRunning