Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): place web proxy with web access settings
Xubin Ren7a3a0559c4f3
diff --git a/docs/configuration.md b/docs/configuration.mdindex c7cf32dfc..311e5cdfa 100644--- a/docs/configuration.md+++ b/docs/configuration.md@@ -1709,6 +1709,13 @@ Keep whitelist entries as narrow as possible, such as a single host CIDR (`192.1HTTP/SSE MCP connections use the same process-wide proxy environment behavior as `web_fetch`: proxied targets use the configured proxy, and URLs excluded by `NO_PROXY` remain DNS-pinned direct connections.+In WebUI, open **Settings → Capabilities → Web access → Configure → Advanced options**+to set the web proxy. This setting applies to the agent's web search and page reading,+not model providers, MCP, or your browser. `127.0.0.1` refers to the machine that runs+nanobot, not the phone or computer that opens WebUI. Clear the field to use the default+network settings, which can include proxy environment variables. After saving, restart+nanobot when WebUI requests it. You can configure the proxy before enabling web access.+> [!TIP]> Use `proxy` in `tools.web` to route web requests through a proxy:> ```jsondiff --git a/tests/webui/test_settings_runtime.py b/tests/webui/test_settings_runtime.pyindex 7cf753a1f..f72550256 100644--- a/tests/webui/test_settings_runtime.py+++ b/tests/webui/test_settings_runtime.py@@ -17,6 +17,22 @@ from nanobot.webui.settings_runtime import ()+def test_web_proxy_roundtrip_while_disabled_preserves_model_proxy(tmp_path):+ path = tmp_path / "config.json"+ config = Config()+ config.tools.web.enable = False+ config.providers.openai.proxy = "http://model-proxy.example:8080"+ save_config(config, path)+ for proxy in ("http://web-proxy.example:7890", None):+ payload = update_runtime_config_settings({"tools.web.proxy": proxy}, local_browser=True, config_path=path)+ assert payload["runtime_config"]["tools.web.proxy"] == proxy+ assert payload["requires_restart"]+ saved = load_config(path)+ assert saved.tools.web.proxy == proxy+ assert saved.tools.web.enable is False+ assert saved.providers.openai.proxy == "http://model-proxy.example:8080"++def test_runtime_patch_persists_and_preserves_other_domains(tmp_path):path = tmp_path / "config.json"config = Config.model_validate({diff --git a/webui/src/components/settings/SettingsPage.tsx b/webui/src/components/settings/SettingsPage.tsxindex 414d10fbe..082964590 100644--- a/webui/src/components/settings/SettingsPage.tsx+++ b/webui/src/components/settings/SettingsPage.tsx@@ -519,7 +519,9 @@ export function SettingsPage({olostepFeature={featureCatalog.find((feature) => feature.name === "olostep")}olostepInstalling={nanobotFeatureAction === "enable:olostep"}capabilityError={nanobotFeaturesError}- />+ >+ {settings.runtime_config ? runtimeConfiguration("network") : null}+ </WebSettings></div>);case "channels":diff --git a/webui/src/components/settings/capabilities/WebSettings.tsx b/webui/src/components/settings/capabilities/WebSettings.tsxindex 7d8bdcc02..6a3221cd0 100644--- a/webui/src/components/settings/capabilities/WebSettings.tsx+++ b/webui/src/components/settings/capabilities/WebSettings.tsx@@ -1,6 +1,6 @@import { useAutoSave } from "@/components/settings/shared/useAutoSave";import { SettingsAdvancedOptions } from "@/components/settings/shared/SettingsFeature";-import type { Dispatch, SetStateAction } from "react";+import type { Dispatch, ReactNode, SetStateAction } from "react";import { Eye, EyeOff, Pencil } from "lucide-react";import { useTranslation } from "react-i18next";@@ -96,6 +96,7 @@ export function WebSettings({olostepFeature,olostepInstalling,capabilityError,+ children,}: {embedded?: boolean;error?: string;@@ -118,6 +119,7 @@ export function WebSettings({olostepFeature?: NanobotFeatureInfo;olostepInstalling: boolean;capabilityError: string | null;+ children?: ReactNode;}) {const { t } = useTranslation();const tx = (key: string, fallback: string) => t(key, { defaultValue: fallback });@@ -272,6 +274,7 @@ export function WebSettings({label={effectiveJinaReader ? tx("settings.values.on", "On") : tx("settings.values.off", "Off")}/></SettingsRow>+ {children}</SettingsAdvancedOptions></div><RestartSettingsFooterdiff --git a/webui/src/components/settings/system/runtime-config-fields.ts b/webui/src/components/settings/system/runtime-config-fields.tsindex 23c4aca41..9c7479370 100644--- a/webui/src/components/settings/system/runtime-config-fields.ts+++ b/webui/src/components/settings/system/runtime-config-fields.ts@@ -9,7 +9,7 @@ export interface RuntimeConfigField {max?: number;}-export type RuntimeConfigPage = "memory" | "runtime" | "advanced" | "browser" | "image";+export type RuntimeConfigPage = "memory" | "runtime" | "advanced" | "browser" | "network" | "image";export const RUNTIME_CONFIG_GROUPS: { id: string; page: RuntimeConfigPage; enabledBy?: string }[] = [{ id: "identity", page: "runtime" },@@ -20,7 +20,7 @@ export const RUNTIME_CONFIG_GROUPS: { id: string; page: RuntimeConfigPage; enabl{ id: "tools", page: "runtime" },{ id: "web", page: "browser" },{ id: "shell", page: "advanced", enabledBy: "tools.exec.enable" },- { id: "network", page: "advanced", enabledBy: "tools.web.enable" },+ { id: "network", page: "network" },{ id: "safety", page: "advanced" },{ id: "cli", page: "advanced", enabledBy: "tools.cli_apps.enable" },{ id: "gateway", page: "advanced" },diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.jsonindex 0337bc9bf..04ceea00d 100644--- a/webui/src/i18n/locales/en/common.json+++ b/webui/src/i18n/locales/en/common.json@@ -499,7 +499,7 @@},"tools_web_proxy": {"label": "Web proxy",- "help": "Proxy URL; leave blank for the default network.\n\nProxy URL for web tools. Leave empty to use the default network configuration."+ "help": "Used for the agent's web search and page reading. Leave blank to use the default network settings, including proxy environment variables.\n\n127.0.0.1 refers to the machine that runs nanobot. This setting does not change model, MCP, or browser connections."},"tools_web_user_agent": {"label": "User agent",diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.jsonindex 96ef6e11d..1d825cd6d 100644--- a/webui/src/i18n/locales/es/common.json+++ b/webui/src/i18n/locales/es/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "Variables de entorno", "help": "Variables adicionales para los comandos, un nombre por línea.\n\nVariables adicionales que se pasan a los comandos, una por línea. Las variables básicas necesarias siguen disponibles."},"tools_exec_allow_patterns": {"label": "Comandos permitidos", "help": "Ejecuta solo comandos que coincidan por completo con las reglas permitidas.\n\nUna expresión regular por línea. Si añades reglas, cada segmento del comando debe coincidir por completo con alguna de ellas. Los comandos permitidos omiten las reglas de bloqueo integradas y personalizadas, pero mantienen las restricciones de red y del espacio de trabajo."},"tools_exec_deny_patterns": {"label": "Comandos bloqueados", "help": "Bloquea los comandos que coincidan con estas reglas.\n\nExpresiones regulares de bloqueo adicionales, una por línea. Las reglas de permiso explícitas tienen prioridad sobre las reglas de bloqueo integradas y personalizadas."},- "tools_web_proxy": {"label": "Proxy web", "help": "URL del proxy; en blanco usa la red predeterminada.\n\nURL del proxy para las herramientas web. Déjalo vacío para usar la red predeterminada."},+ "tools_web_proxy": {"label": "Proxy web", "help": "Se usa para las búsquedas web y la lectura de páginas del agente. Déjalo vacío para usar la red predeterminada, incluidas las variables de entorno del proxy.\n\n127.0.0.1 es el equipo que ejecuta nanobot. Este ajuste no cambia las conexiones de modelos, MCP ni del navegador."},"tools_web_user_agent": {"label": "Cabecera User-Agent", "help": "User-Agent para solicitudes web; en blanco usa el predeterminado.\n\nCabecera User-Agent personalizada. Déjalo vacío para usar el valor predeterminado."},"tools_restrict_to_workspace": {"label": "Restricción del espacio", "help": "Límites globales del espacio; los permisos de chats WebUI se ajustan aparte.\n\nPolítica global de herramientas. Los permisos de cada conversación WebUI se configuran por separado."},"tools_ssrf_whitelist": {"label": "IP permitidas", "help": "IP o rangos CIDR permitidos, uno por línea.\n\nDirecciones IP o rangos CIDR exentos de la protección de solicitudes salientes, uno por línea."},diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.jsonindex dd7c78638..5c9e8ab29 100644--- a/webui/src/i18n/locales/fr/common.json+++ b/webui/src/i18n/locales/fr/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "Variables d’environnement", "help": "Variables supplémentaires transmises aux commandes, un nom par ligne.\n\nVariables supplémentaires à transmettre aux commandes, une par ligne. Les variables nécessaires au fonctionnement restent disponibles."},"tools_exec_allow_patterns": {"label": "Commandes autorisées", "help": "Exécutez seulement les commandes correspondant entièrement aux règles d’autorisation.\n\nUne expression régulière par ligne. Si cette liste est renseignée, chaque segment de commande doit correspondre entièrement à une règle. Les commandes autorisées échappent aux règles de blocage intégrées et personnalisées, mais restent soumises aux restrictions réseau et d’espace de travail."},"tools_exec_deny_patterns": {"label": "Commandes bloquées", "help": "Bloquez les commandes correspondant à ces règles.\n\nExpressions régulières de blocage supplémentaires, une par ligne. Les règles d’autorisation explicites ont priorité sur ces règles et sur les protections intégrées."},- "tools_web_proxy": {"label": "Proxy web", "help": "URL du proxy ; laissez vide pour le réseau par défaut.\n\nURL du proxy des outils web. Laissez vide pour utiliser le réseau par défaut."},+ "tools_web_proxy": {"label": "Proxy web", "help": "Utilisé pour la recherche web et la lecture de pages par l’agent. Laissez vide pour utiliser le réseau par défaut, y compris les variables d’environnement du proxy.\n\n127.0.0.1 désigne la machine qui exécute nanobot. Ce réglage ne change pas les connexions des modèles, de MCP ou du navigateur."},"tools_web_user_agent": {"label": "En-tête User-Agent", "help": "User-Agent des requêtes web ; laissez vide pour la valeur par défaut.\n\nEn-tête User-Agent personnalisé. Laissez vide pour utiliser la valeur par défaut."},"tools_restrict_to_workspace": {"label": "Restriction de l’espace", "help": "Limites globales de l’espace ; les permissions WebUI sont réglées séparément.\n\nRègle globale des outils. Les autorisations de chaque conversation WebUI sont distinctes."},"tools_ssrf_whitelist": {"label": "IP autorisées", "help": "IP ou plages CIDR autorisées, une par ligne.\n\nAdresses IP ou plages CIDR exemptées de la protection des requêtes sortantes, une par ligne."},diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.jsonindex 9f4cfa62d..8f1cbbdc3 100644--- a/webui/src/i18n/locales/id/common.json+++ b/webui/src/i18n/locales/id/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "Variabel lingkungan", "help": "Variabel tambahan untuk perintah, satu nama per baris.\n\nVariabel tambahan yang diteruskan ke perintah, satu per baris. Variabel dasar yang diperlukan tetap tersedia."},"tools_exec_allow_patterns": {"label": "Perintah diizinkan", "help": "Hanya jalankan perintah yang cocok sepenuhnya dengan aturan izin.\n\nSatu ekspresi reguler per baris. Jika diisi, setiap bagian perintah harus cocok sepenuhnya dengan salah satu aturan. Perintah yang diizinkan melewati aturan pemblokiran bawaan dan tambahan, tetapi tetap mengikuti batasan jaringan dan ruang kerja."},"tools_exec_deny_patterns": {"label": "Perintah diblokir", "help": "Blokir perintah yang cocok dengan aturan ini.\n\nAturan pemblokiran tambahan berupa ekspresi reguler, satu per baris. Aturan izin eksplisit mengesampingkan aturan pemblokiran bawaan dan tambahan."},- "tools_web_proxy": {"label": "Proxy web", "help": "URL proxy; kosongkan untuk jaringan default.\n\nURL proxy untuk alat web. Kosongkan untuk memakai jaringan default."},+ "tools_web_proxy": {"label": "Proxy web", "help": "Digunakan untuk pencarian web dan pembacaan halaman oleh agen. Kosongkan untuk memakai pengaturan jaringan default, termasuk variabel lingkungan proxy.\n\n127.0.0.1 adalah mesin yang menjalankan nanobot. Pengaturan ini tidak mengubah koneksi model, MCP, atau browser."},"tools_web_user_agent": {"label": "Header User-Agent", "help": "User-Agent untuk permintaan web; kosongkan untuk nilai default.\n\nHeader User-Agent kustom. Kosongkan untuk memakai nilai default."},"tools_restrict_to_workspace": {"label": "Batas ruang kerja", "help": "Batas ruang kerja global; izin chat WebUI diatur terpisah.\n\nKebijakan alat global. Izin setiap percakapan WebUI diatur secara terpisah."},"tools_ssrf_whitelist": {"label": "IP diizinkan", "help": "IP atau rentang CIDR diizinkan, satu per baris.\n\nIP atau rentang CIDR yang dikecualikan dari perlindungan permintaan keluar, satu per baris."},diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.jsonindex 5c2e8226a..c7295ab65 100644--- a/webui/src/i18n/locales/ja/common.json+++ b/webui/src/i18n/locales/ja/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "環境変数", "help": "コマンドに追加で渡す変数名を1行に1つ指定します。\n\nコマンドに渡す環境変数を追加します。1 行に 1 つ指定してください。動作に必要な基本の環境変数は引き続き渡されます。"},"tools_exec_allow_patterns": {"label": "許可コマンド", "help": "許可ルールに完全一致するコマンドのみ実行します。\n\n1 行に 1 つ正規表現を指定します。設定すると、コマンドの各部分がいずれかのルールに完全一致する場合のみ実行できます。許可されたコマンドには組み込み・追加の禁止ルールを適用しませんが、ネットワークとワークスペースの制限は適用されます。"},"tools_exec_deny_patterns": {"label": "禁止コマンド", "help": "これらのルールに一致するコマンドを禁止します。\n\n追加の禁止ルールを正規表現で 1 行に 1 つ指定します。明示的な許可ルールは、組み込み・追加の禁止ルールより優先されます。"},- "tools_web_proxy": {"label": "ウェブプロキシ", "help": "プロキシの URL です。空欄では既定のネットワークを使います。\n\nウェブツール用のプロキシ URL。空欄の場合は既定のネットワークを使用します。"},+ "tools_web_proxy": {"label": "ウェブプロキシ", "help": "エージェントのウェブ検索とページ読み取りに使用します。空欄では、プロキシ環境変数を含む既定のネットワーク設定を使用します。\n\n127.0.0.1 は nanobot を実行するマシンです。モデル、MCP、ブラウザーの接続には影響しません。"},"tools_web_user_agent": {"label": "User-Agent ヘッダー", "help": "ウェブ要求の User-Agent です。空欄では既定値を使います。\n\nカスタムの User-Agent ヘッダー。空欄の場合は既定値を使用します。"},"tools_restrict_to_workspace": {"label": "ワークスペース制限", "help": "ワークスペースの全体制限です。WebUI のチャット権限は別に設定します。\n\nツール全体のアクセス方針です。WebUI の会話ごとの権限は別途設定します。"},"tools_ssrf_whitelist": {"label": "許可 IP", "help": "許可する IP または CIDR を1行に1つ指定します。\n\n送信リクエストの保護から除外する IP/CIDR 範囲。1 行に 1 つ指定します。"},diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.jsonindex e8d4fd381..6fb2db0bb 100644--- a/webui/src/i18n/locales/ko/common.json+++ b/webui/src/i18n/locales/ko/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "환경 변수", "help": "명령에 추가로 전달할 변수 이름을 한 줄에 하나씩 입력하세요.\n\n명령에 전달할 환경 변수를 추가합니다. 한 줄에 하나씩 입력하세요. 실행에 필요한 기본 환경 변수는 계속 전달됩니다."},"tools_exec_allow_patterns": {"label": "허용 명령", "help": "허용 규칙과 완전히 일치하는 명령만 실행합니다.\n\n정규식을 한 줄에 하나씩 입력하세요. 규칙을 추가하면 명령의 각 부분이 규칙 중 하나와 완전히 일치해야 실행됩니다. 허용된 명령에는 기본 및 추가 차단 규칙이 적용되지 않지만, 네트워크와 작업 공간 제한은 유지됩니다."},"tools_exec_deny_patterns": {"label": "차단 명령", "help": "이 규칙과 일치하는 명령을 차단합니다.\n\n추가 차단 정규식을 한 줄에 하나씩 입력하세요. 명시적 허용 규칙이 기본 및 추가 차단 규칙보다 우선합니다."},- "tools_web_proxy": {"label": "웹 프록시", "help": "프록시 URL입니다. 비워 두면 기본 네트워크를 사용합니다.\n\n웹 도구의 프록시 URL입니다. 비워 두면 기본 네트워크를 사용합니다."},+ "tools_web_proxy": {"label": "웹 프록시", "help": "에이전트의 웹 검색과 페이지 읽기에 사용합니다. 비워 두면 프록시 환경 변수를 포함한 기본 네트워크 설정을 사용합니다.\n\n127.0.0.1은 nanobot이 실행되는 기기입니다. 모델, MCP 또는 브라우저 연결에는 영향을 주지 않습니다."},"tools_web_user_agent": {"label": "User-Agent 헤더", "help": "웹 요청의 User-Agent입니다. 비워 두면 기본값을 사용합니다.\n\n사용자 지정 User-Agent 헤더입니다. 비워 두면 기본값을 사용합니다."},"tools_restrict_to_workspace": {"label": "작업 공간 제한", "help": "전체 작업 공간 제한입니다. WebUI 채팅 권한은 별도로 설정합니다.\n\n전체 도구 접근 정책입니다. WebUI의 대화별 권한은 별도로 설정합니다."},"tools_ssrf_whitelist": {"label": "허용 IP", "help": "허용할 IP 또는 CIDR 범위를 한 줄에 하나씩 입력하세요.\n\n외부 요청 보호에서 제외할 IP/CIDR 범위를 한 줄에 하나씩 입력하세요."},diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.jsonindex 2adcb37b0..d6d8e2ea6 100644--- a/webui/src/i18n/locales/pt-BR/common.json+++ b/webui/src/i18n/locales/pt-BR/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "Variáveis de ambiente", "help": "Variáveis extras para os comandos, um nome por linha.\n\nVariáveis adicionais passadas aos comandos, uma por linha. As variáveis básicas necessárias continuam disponíveis."},"tools_exec_allow_patterns": {"label": "Comandos permitidos", "help": "Execute apenas comandos que correspondam totalmente às regras de permissão.\n\nUma expressão regular por linha. Se houver regras, cada trecho do comando deve corresponder por completo a uma delas. Os comandos permitidos ignoram as regras de bloqueio integradas e personalizadas, mas continuam sujeitos às restrições de rede e do espaço de trabalho."},"tools_exec_deny_patterns": {"label": "Comandos bloqueados", "help": "Bloqueie comandos que correspondam a estas regras.\n\nExpressões regulares de bloqueio adicionais, uma por linha. As regras de permissão explícitas têm prioridade sobre as regras de bloqueio integradas e personalizadas."},- "tools_web_proxy": {"label": "Proxy web", "help": "URL do proxy; deixe vazio para usar a rede padrão.\n\nURL do proxy das ferramentas web. Deixe vazio para usar a rede padrão."},+ "tools_web_proxy": {"label": "Proxy web", "help": "Usado para a pesquisa web e a leitura de páginas pelo agente. Deixe em branco para usar a rede padrão, incluindo as variáveis de ambiente de proxy.\n\n127.0.0.1 é a máquina que executa nanobot. Esta configuração não altera as conexões de modelos, MCP ou do navegador."},"tools_web_user_agent": {"label": "Cabeçalho User-Agent", "help": "User-Agent das solicitações web; deixe vazio para usar o padrão.\n\nCabeçalho User-Agent personalizado. Deixe vazio para usar o valor padrão."},"tools_restrict_to_workspace": {"label": "Restrição do espaço", "help": "Limites globais do espaço; permissões de conversas WebUI são separadas.\n\nPolítica global das ferramentas. As permissões de cada conversa WebUI são configuradas separadamente."},"tools_ssrf_whitelist": {"label": "IPs permitidos", "help": "IPs ou faixas CIDR permitidos, um por linha.\n\nEndereços IP ou faixas CIDR isentos da proteção de solicitações de saída, um por linha."},diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.jsonindex 3091c47c4..8a064b607 100644--- a/webui/src/i18n/locales/vi/common.json+++ b/webui/src/i18n/locales/vi/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "Biến môi trường", "help": "Thêm biến truyền cho lệnh, mỗi dòng một tên.\n\nCác biến môi trường bổ sung được truyền cho lệnh, mỗi dòng một tên. Các biến cơ bản cần cho hoạt động vẫn được truyền."},"tools_exec_allow_patterns": {"label": "Lệnh được phép", "help": "Chỉ chạy lệnh khớp hoàn toàn với quy tắc cho phép.\n\nMỗi dòng một biểu thức chính quy. Khi có quy tắc, từng phần của lệnh phải khớp hoàn toàn với ít nhất một quy tắc. Lệnh được phép sẽ bỏ qua quy tắc chặn tích hợp và bổ sung, nhưng vẫn chịu giới hạn mạng và không gian làm việc."},"tools_exec_deny_patterns": {"label": "Lệnh bị chặn", "help": "Chặn lệnh khớp với các quy tắc này.\n\nQuy tắc chặn bổ sung dưới dạng biểu thức chính quy, mỗi dòng một quy tắc. Quy tắc cho phép được ưu tiên hơn cả quy tắc chặn tích hợp và bổ sung."},- "tools_web_proxy": {"label": "Proxy web", "help": "URL proxy; để trống để dùng mạng mặc định.\n\nURL proxy cho công cụ web. Để trống để dùng mạng mặc định."},+ "tools_web_proxy": {"label": "Proxy web", "help": "Dùng cho tìm kiếm web và đọc trang của tác nhân. Để trống để dùng mạng mặc định, bao gồm các biến môi trường proxy.\n\n127.0.0.1 là máy chạy nanobot. Cài đặt này không thay đổi kết nối mô hình, MCP hoặc trình duyệt."},"tools_web_user_agent": {"label": "Header User-Agent", "help": "User-Agent cho yêu cầu web; để trống để dùng mặc định.\n\nHeader User-Agent tùy chỉnh cho yêu cầu web. Để trống để dùng giá trị mặc định."},"tools_restrict_to_workspace": {"label": "Giới hạn vùng làm việc", "help": "Giới hạn vùng làm việc chung; quyền trò chuyện WebUI được đặt riêng.\n\nChính sách công cụ toàn cục. Quyền của từng cuộc trò chuyện WebUI được đặt riêng."},"tools_ssrf_whitelist": {"label": "IP được phép", "help": "IP hoặc dải CIDR được phép, mỗi dòng một mục.\n\nIP hoặc dải CIDR được miễn bảo vệ yêu cầu ra ngoài, mỗi dòng một mục."},diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.jsonindex 1f5b5d5b2..2da14aa9a 100644--- a/webui/src/i18n/locales/zh-CN/common.json+++ b/webui/src/i18n/locales/zh-CN/common.json@@ -499,7 +499,7 @@},"tools_web_proxy": {"label": "网页代理",- "help": "网页代理地址,留空用默认网络\n\n网页搜索和读取使用的代理地址,留空使用默认网络设置。"+ "help": "用于智能体搜索和读取网页。留空使用默认网络设置,包括环境变量中的代理。\n\n127.0.0.1 指运行 nanobot 的机器,不是打开网页的手机。本设置不影响模型、MCP 或浏览器的连接。"},"tools_web_user_agent": {"label": "User-Agent",diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.jsonindex cf462c557..c413fb9a2 100644--- a/webui/src/i18n/locales/zh-TW/common.json+++ b/webui/src/i18n/locales/zh-TW/common.json@@ -416,7 +416,7 @@"tools_exec_allowed_env_keys": {"label": "環境變數", "help": "額外傳給命令的變數名,每行一個\n\n除必需變數外,還要從主機傳遞給命令的環境變數名稱,每行一個。"},"tools_exec_allow_patterns": {"label": "允許命令", "help": "只允許完整匹配規則的命令\n\n每行一個正規表示式。填寫後,只允許每段命令都完整匹配規則的命令執行,且優先於內建和自定義拒絕規則;工作區和網路限制仍生效。"},"tools_exec_deny_patterns": {"label": "禁止命令", "help": "阻止匹配規則的命令\n\n每行一個正規表示式,與內建拒絕規則一同檢查。完整匹配允許規則的命令會跳過這些檢查。"},- "tools_web_proxy": {"label": "網頁代理", "help": "網頁代理地址,留空用預設網路\n\n網頁搜尋和讀取使用的代理地址,留空使用預設網路設定。"},+ "tools_web_proxy": {"label": "網頁代理", "help": "用於智慧體搜尋和讀取網頁。留空使用預設網路設定,包括環境變數中的代理。\n\n127.0.0.1 指執行 nanobot 的機器,不是開啟網頁的手機。本設定不影響模型、MCP 或瀏覽器的連線。"},"tools_web_user_agent": {"label": "User-Agent", "help": "網頁請求標識,留空使用預設值\n\n網頁請求使用的 User-Agent 標識,留空使用預設值。"},"tools_restrict_to_workspace": {"label": "目錄限制", "help": "全域性目錄限制,WebUI 許可權另設\n\n設定全域性工作區訪問限制;WebUI 中每個對話的許可權單獨設定。"},"tools_ssrf_whitelist": {"label": "允許 IP", "help": "允許訪問的 IP 或 CIDR,每行一項\n\n允許網頁等出站請求訪問這些受限地址。每行填寫一個 IP 地址或 CIDR 網段。"},diff --git a/webui/src/tests/settings-capabilities.test.tsx b/webui/src/tests/settings-capabilities.test.tsxindex e2f08ace5..d0ebdc250 100644--- a/webui/src/tests/settings-capabilities.test.tsx+++ b/webui/src/tests/settings-capabilities.test.tsx@@ -8,6 +8,35 @@ import { requestMutationMock, jsonResponse, settingsPayload, renderSettingsView,describe("Settings capabilities", () => {installSettingsViewTestHooks();+ it("edits the existing web proxy in web access even while disabled, without a duplicate advanced editor", async () => {+ let payload = { ...settingsPayload(), runtime_config: {+ "tools.web.enable": false, "tools.web.proxy": "http://old-proxy.example:8080", "tools.web.user_agent": null,+ } } as SettingsPayload;+ requestMutationMock.mockImplementation(async (_method, update) => {+ payload = { ...payload, runtime_config: { ...payload.runtime_config, ...update.values },+ requires_restart: true, restart_required_sections: ["runtime"] };+ return payload;+ });+ renderSettingsView({ initialSection: "capabilities", initialSettings: payload });+ fireEvent.click(within(screen.getByRole("region", { name: "Web access" })).getByRole("button", { name: "Configure" }));+ fireEvent.click(screen.getByRole("button", { name: "Advanced options" }));+ const proxy = screen.getByRole("textbox", { name: "Web proxy", exact: true });+ expect(proxy).toHaveValue("http://old-proxy.example:8080");+ fireEvent.change(proxy, { target: { value: "http://new-proxy.example:7890" } });+ await waitFor(() => expect(requestMutationMock).toHaveBeenCalledWith(+ "settings.runtime_config.update", { values: { "tools.web.proxy": "http://new-proxy.example:7890" } }, 20_000,+ ));+ expect(await screen.findByText("Saved. Restart to apply changes.")).toBeVisible();+ fireEvent.change(proxy, { target: { value: "" } });+ await waitFor(() => expect(requestMutationMock).toHaveBeenLastCalledWith(+ "settings.runtime_config.update", { values: { "tools.web.proxy": null } }, 20_000,+ ));+ fireEvent.click(within(screen.getByRole("dialog", { name: "Web access" })).getByRole("button", { name: "Close", exact: true }));+ expect(screen.getByRole("switch", { name: "Web access" })).not.toBeChecked();+ fireEvent.click(screen.getByRole("button", { name: "Advanced", exact: true }));+ expect(screen.queryByRole("textbox", { name: "Web proxy", exact: true })).not.toBeInTheDocument();+ });+it("opens configuration for disabled features without enabling them", () => {const payload = settingsPayload();payload.image_generation.enabled = false;