chore(backup): 保存新版预审开发前的代码与文档基线
verify / test-and-build (push) Canceled after 0s

This commit is contained in:
2026-09-28 16:34:10 +08:00
parent b10093f9d8
commit 4d5a420671
37 changed files with 3890 additions and 10 deletions
+4 -3
View File
@@ -553,13 +553,14 @@ def local_model(skill, values, evidence, system_prompt=None):
endpoint=os.getenv("XINGBANG_LOCAL_MODEL_URL", "")
if not endpoint: raise ValueError("未配置 XINGBANG_LOCAL_MODEL_URL")
url=urlparse(endpoint)
allowed=url.hostname=="localhost"
official_deepseek=url.scheme=="https" and url.hostname=="api.deepseek.com" and url.port in (None,443)
allowed=url.hostname=="localhost" or official_deepseek
try:
address=ipaddress.ip_address(url.hostname or "")
allowed=address.is_loopback or any(address in ipaddress.ip_network(net) for net in ("10.0.0.0/8","172.16.0.0/12","192.168.0.0/16") if address.version==4)
except ValueError: pass
if url.scheme not in ("http","https") or not allowed or url.username or url.password:
raise ValueError("模型地址必须使用 localhost 或内网 IP,禁止外部模型地址")
if url.scheme not in ("http","https") or not allowed or url.username or url.password or url.query or url.fragment:
raise ValueError("模型地址必须使用 localhost、内网 IP 或 DeepSeek 官方 HTTPS 地址")
from graph.risk_task import invoke_risk_task
return invoke_risk_task(skill, values, evidence, endpoint, system_prompt=system_prompt)