replace main with lightweight memory gateway

This commit is contained in:
2026-06-11 10:06:48 +08:00
parent 000415404b
commit b74923e435
56 changed files with 2052 additions and 76129 deletions

40
core/config.py Normal file
View File

@ -0,0 +1,40 @@
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
_PROJECT_ROOT = Path(__file__).resolve().parents[1]
@dataclass(frozen=True)
class GatewayConfig:
everos_base_url: str = "http://127.0.0.1:8000"
database_path: Path = _PROJECT_ROOT / "data" / "memory_gateway.sqlite3"
storage_dir: Path = _PROJECT_ROOT / "data" / "storage"
resource_search_batch_size: int = 50
@classmethod
def from_env(cls) -> GatewayConfig:
return cls(
everos_base_url=os.environ.get(
"EVEROS_BASE_URL",
"http://127.0.0.1:8000",
).rstrip("/"),
database_path=Path(
os.environ.get(
"MEMORY_GATEWAY_DB_PATH",
str(_PROJECT_ROOT / "data" / "memory_gateway.sqlite3"),
)
),
storage_dir=Path(
os.environ.get(
"MEMORY_GATEWAY_STORAGE_DIR",
str(_PROJECT_ROOT / "data" / "storage"),
)
),
resource_search_batch_size=int(
os.environ.get("MEMORY_GATEWAY_RESOURCE_SEARCH_BATCH_SIZE", "50")
),
)