feat(platform): show deployment outbound IPs on adapter config forms

Cloud/NAT deployments couldn't complete WeCom-family / Official Account /
QQ Official setup because the trusted-IP (IP whitelist) value — the
server's egress IPs — was nowhere visible in LangBot.

- config.yaml: new system.outbound_ips list (env: SYSTEM__OUTBOUND_IPS,
  comma-separated), exposed via GET /api/v1/system/info
- dynamic form: generic __system.*-named display-only fields resolved
  from systemContext (same namespace as show_if), one read-only row per
  value with a copy button, excluded from form state and emitted values;
  hidden entirely when the deployment provides no IPs
- manifests: trusted-IP display field for wecom, wecomcs, wecombot,
  officialaccount, qqofficial

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Junyan Qin
2026-06-10 19:41:14 +08:00
parent 47ade18596
commit bca710dbd4
14 changed files with 201 additions and 6 deletions

View File

@@ -31,6 +31,18 @@ class SystemRouterGroup(group.RouterGroup):
except Exception:
pass
# ``system.outbound_ips`` may be a comma-separated string instead of
# a list when injected via the SYSTEM__OUTBOUND_IPS env var into a
# pre-existing data/config.yaml that lacks the key (env overrides
# only coerce to list when the key already holds one).
outbound_ips = self.ap.instance_config.data.get('system', {}).get('outbound_ips', [])
if isinstance(outbound_ips, str):
outbound_ips = [ip.strip() for ip in outbound_ips.split(',') if ip.strip()]
elif isinstance(outbound_ips, list):
outbound_ips = [str(ip).strip() for ip in outbound_ips if str(ip).strip()]
else:
outbound_ips = []
return self.success(
data={
'version': constants.semantic_version,
@@ -49,6 +61,7 @@ class SystemRouterGroup(group.RouterGroup):
'disable_models_service', False
),
'limitation': self.ap.instance_config.data.get('system', {}).get('limitation', {}),
'outbound_ips': outbound_ips,
'wizard_status': wizard_status,
'wizard_progress': wizard_progress,
}

View File

@@ -31,6 +31,18 @@ spec:
type: webhook-url
required: false
default: ""
- name: __system.outbound_ips
label:
en_US: IP Whitelist
zh_Hans: IP 白名单
zh_Hant: IP 白名單
description:
en_US: Add these outbound IPs of the LangBot server to the IP whitelist in the "Basic Configuration" of the WeChat Official Account platform
zh_Hans: 请将这些 LangBot 服务器的出网 IP 添加到微信公众平台「基本配置」中的 IP 白名单
zh_Hant: 請將這些 LangBot 伺服器的出網 IP 加入微信公眾平台「基本配置」中的 IP 白名單
type: array[string]
required: false
default: []
- name: token
label:
en_US: Token

View File

@@ -19,6 +19,18 @@ spec:
en: https://link.langbot.app/en/platforms/qqofficial
ja: https://link.langbot.app/ja/platforms/qqofficial
config:
- name: __system.outbound_ips
label:
en_US: IP Whitelist
zh_Hans: IP 白名单
zh_Hant: IP 白名單
description:
en_US: Add these outbound IPs of the LangBot server to the IP whitelist in the development settings of the QQ Open Platform
zh_Hans: 请将这些 LangBot 服务器的出网 IP 添加到 QQ 开放平台开发设置中的 IP 白名单
zh_Hant: 請將這些 LangBot 伺服器的出網 IP 加入 QQ 開放平台開發設定中的 IP 白名單
type: array[string]
required: false
default: []
- name: appid
label:
en_US: App ID

View File

@@ -32,6 +32,18 @@ spec:
type: webhook-url
required: false
default: ""
- name: __system.outbound_ips
label:
en_US: Trusted IPs
zh_Hans: 企业可信 IP
zh_Hant: 企業可信 IP
description:
en_US: Add these outbound IPs of the LangBot server to the "Trusted Enterprise IPs" of your app in the WeCom admin console
zh_Hans: 请将这些 LangBot 服务器的出网 IP 添加到企业微信管理后台应用详情页的「企业可信 IP」中
zh_Hant: 請將這些 LangBot 伺服器的出網 IP 加入企業微信管理後台應用詳情頁的「企業可信 IP」中
type: array[string]
required: false
default: []
- name: corpid
label:
en_US: Corpid

View File

@@ -75,6 +75,18 @@ spec:
field: enable-webhook
operator: eq
value: true
- name: __system.outbound_ips
label:
en_US: Trusted IPs
zh_Hans: 企业可信 IP
zh_Hant: 企業可信 IP
description:
en_US: Add these outbound IPs of the LangBot server to the "Trusted Enterprise IPs" of the bot configuration in the WeCom admin console
zh_Hans: 请将这些 LangBot 服务器的出网 IP 添加到企业微信管理后台智能机器人配置的「企业可信 IP」中
zh_Hant: 請將這些 LangBot 伺服器的出網 IP 加入企業微信管理後台智慧機器人設定的「企業可信 IP」中
type: array[string]
required: false
default: []
- name: Secret
label:
en_US: Secret

View File

@@ -31,6 +31,18 @@ spec:
type: webhook-url
required: false
default: ""
- name: __system.outbound_ips
label:
en_US: Trusted IPs
zh_Hans: 企业可信 IP
zh_Hant: 企業可信 IP
description:
en_US: Add these outbound IPs of the LangBot server to the "Trusted Enterprise IPs" of WeChat Customer Service in the WeCom admin console
zh_Hans: 请将这些 LangBot 服务器的出网 IP 添加到企业微信管理后台微信客服的「企业可信 IP」中
zh_Hant: 請將這些 LangBot 伺服器的出網 IP 加入企業微信管理後台微信客服的「企業可信 IP」中
type: array[string]
required: false
default: []
- name: corpid
label:
en_US: Corpid

View File

@@ -21,6 +21,13 @@ system:
recovery_key: ''
allow_modify_login_info: true
disabled_adapters: []
# Public outbound IP addresses of this LangBot deployment. Some platforms
# (e.g. WeCom, WeChat Official Account, QQ Official API) require the
# caller's IPs to be added to their trusted-IP / IP-whitelist settings.
# When set, the web UI shows these IPs on the bot config form of such
# adapters. Also settable via the SYSTEM__OUTBOUND_IPS env var
# (comma-separated). Empty list = hidden in the web UI.
outbound_ips: []
limitation:
max_bots: -1
max_pipelines: -1