docs(memory): document and harden hybrid gateway setup

This commit is contained in:
2026-06-15 11:19:57 +08:00
parent c3b4f95062
commit 827e3434b3
5 changed files with 74 additions and 3 deletions

View File

@ -266,13 +266,18 @@ def _parse_memory(data: dict[str, Any]) -> MemoryConfig:
parsed_timeout = _float(
_first_config_value(gateway_raw.get("timeoutSeconds"), gateway_raw.get("timeout_seconds"))
)
scope = (
_string_list(gateway_raw.get("scope"))
if "scope" in gateway_raw
else ["current_chat", "resources"]
)
gateway = MemoryGatewayConfig(
base_url=_string(gateway_raw.get("baseUrl") or gateway_raw.get("base_url")) or "",
user_id=_string(gateway_raw.get("userId") or gateway_raw.get("user_id")) or "",
user_key=_string(gateway_raw.get("userKey") or gateway_raw.get("user_key")) or "",
app_id=_string(gateway_raw.get("appId") or gateway_raw.get("app_id")) or "default",
project_id=_string(gateway_raw.get("projectId") or gateway_raw.get("project_id")) or "default",
scope=_string_list(gateway_raw.get("scope")) or ["current_chat", "resources"],
scope=scope,
top_k=8 if parsed_top_k is None else parsed_top_k,
timeout_seconds=10.0 if parsed_timeout is None else parsed_timeout,
)