feat: add OpenClaw User-Agent toggle, default off

Add a switch in the OpenClaw provider form to optionally send a browser
User-Agent header. The toggle defaults to off — only providers that
explicitly include headers in their preset or config will have it enabled.

Remove the previous auto-injection logic that force-added User-Agent on
every preset load and new provider creation.
This commit is contained in:
Jason
2026-03-09 10:36:11 +08:00
parent dd971246be
commit cc15d7b1e3
8 changed files with 67 additions and 0 deletions
+2
View File
@@ -1343,6 +1343,8 @@
"cacheWriteCost": "Cache Write Cost ($/M tokens)",
"cacheCostHint": "Cache costs are used to calculate Prompt Caching costs. Leave empty if not using caching.",
"modelsHint": "Configure the models supported by this provider. Model ID is used for API calls, Display Name for the interface.",
"userAgent": "Send User-Agent",
"userAgentHint": "Some providers require a browser User-Agent header to work properly.",
"env": {
"title": "Environment Variables",
"description": "Manage environment variables in openclaw.json (API keys, custom variables, etc.)",
+2
View File
@@ -1343,6 +1343,8 @@
"cacheWriteCost": "キャッシュ書込コスト ($/M トークン)",
"cacheCostHint": "キャッシュコストは Prompt Caching のコスト計算に使用されます。キャッシュを使用しない場合は空欄のままにしてください。",
"modelsHint": "このプロバイダーがサポートするモデルを設定します。モデル ID は API 呼び出しに、表示名はインターフェースに使用されます。",
"userAgent": "User-Agent を送信",
"userAgentHint": "一部のプロバイダーはブラウザの User-Agent ヘッダーが必要です。",
"env": {
"title": "環境変数",
"description": "openclaw.json の環境変数設定を管理(APIキー、カスタム変数など)",
+2
View File
@@ -1343,6 +1343,8 @@
"cacheWriteCost": "缓存写入价格 ($/M tokens)",
"cacheCostHint": "缓存价格用于计算 Prompt Caching 的成本。如不使用缓存可留空。",
"modelsHint": "配置该供应商支持的模型。模型 ID 用于 API 调用,显示名称用于界面展示。",
"userAgent": "发送 User-Agent",
"userAgentHint": "部分供应商需要浏览器 User-Agent 才能正常访问。",
"env": {
"title": "环境变量",
"description": "管理 openclaw.json 中的环境变量配置(API Key、自定义变量等)",