Compare commits
2 Commits
0e146e60d9
...
4748432501
| Author | SHA1 | Date | |
|---|---|---|---|
| 4748432501 | |||
| 83d69097c9 |
@@ -46,8 +46,8 @@ DEFAULT_MODEL=org_auto
|
||||
# 默认模式:chat 或 agent
|
||||
DEFAULT_ASK_MODE=chat
|
||||
|
||||
# 请求侧 tools/tool_choice 透传到 Lingma(默认关闭,开启后可支持工具写文件等场景)
|
||||
TOOL_FORWARD_ENABLED=false
|
||||
# 请求侧 tools/tool_choice 透传到 Lingma(默认开启,可显式关闭)
|
||||
TOOL_FORWARD_ENABLED=true
|
||||
# 可选:允许透传的工具名白名单,逗号分隔;为空表示不额外限制
|
||||
TOOL_ALLOWLIST=
|
||||
|
||||
|
||||
@@ -28,4 +28,4 @@ port=os.environ.get('PORT','8317'); \
|
||||
r=urllib.request.urlopen(f'http://127.0.0.1:{port}/healthz', timeout=3); \
|
||||
sys.exit(0 if json.load(r).get('ok') else 1)" || exit 1
|
||||
|
||||
CMD ["sh", "-c", "python /app/app/bootstrap_lingma.py && uvicorn app.main:app --host ${HOST:-0.0.0.0} --port ${PORT:-8317}"]
|
||||
CMD ["sh", "-c", "python -m app.bootstrap_lingma && uvicorn app.main:app --host ${HOST:-0.0.0.0} --port ${PORT:-8317}"]
|
||||
|
||||
@@ -182,6 +182,6 @@ def load_settings() -> Settings:
|
||||
session_reuse_enabled=_bool_env("SESSION_REUSE_ENABLED", True),
|
||||
session_cache_max_entries=int(os.getenv("SESSION_CACHE_MAX_ENTRIES", "256")),
|
||||
session_cache_ttl_sec=float(os.getenv("SESSION_CACHE_TTL_SEC", "1800")),
|
||||
tool_forward_enabled=_bool_env("TOOL_FORWARD_ENABLED", False),
|
||||
tool_forward_enabled=_bool_env("TOOL_FORWARD_ENABLED", True),
|
||||
tool_allowlist=_csv_env(os.getenv("TOOL_ALLOWLIST", "")),
|
||||
)
|
||||
|
||||
@@ -193,6 +193,18 @@ class ConfigParsingTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual(settings.tool_allowlist, ["lookup", "write_file", "search_docs"])
|
||||
|
||||
def test_load_settings_defaults_tool_forward_enabled_true(self) -> None:
|
||||
with patch.dict(os.environ, {}, clear=True):
|
||||
settings = load_settings()
|
||||
|
||||
self.assertTrue(settings.tool_forward_enabled)
|
||||
|
||||
def test_load_settings_respects_tool_forward_enabled_false(self) -> None:
|
||||
with patch.dict(os.environ, {"TOOL_FORWARD_ENABLED": "false"}, clear=True):
|
||||
settings = load_settings()
|
||||
|
||||
self.assertFalse(settings.tool_forward_enabled)
|
||||
|
||||
def test_load_settings_empty_tool_allowlist(self) -> None:
|
||||
with patch.dict(os.environ, {"TOOL_ALLOWLIST": " , , "}, clear=True):
|
||||
settings = load_settings()
|
||||
|
||||
Reference in New Issue
Block a user