Add brain memory services and APIs

Introduce the backend pieces for brain memory ingestion, routing, and
system telemetry so the new knowledge workflows can project data into a
brain view. The supporting tests lock in the new behavior and keep the
expanded backend surface stable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 13:47:34 +08:00
parent e3691b01bb
commit d2447ee635
28 changed files with 2278 additions and 197 deletions

View File

@@ -1,14 +1,28 @@
from pathlib import Path
from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import Literal
BASE_DIR = Path(__file__).resolve().parent.parent
ENV_FILE = BASE_DIR / ".env"
def _resolve_path(value: str) -> str:
path = Path(value)
if path.is_absolute():
return str(path)
return str((BASE_DIR / path).resolve())
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")
model_config = SettingsConfigDict(env_file=str(ENV_FILE), env_file_encoding="utf-8", extra="ignore")
# === 应用基础 ===
APP_NAME: str = "Jarvis"
APP_VERSION: str = "0.1.0"
DEBUG: bool = False
HOST: str = "127.0.0.1"
PORT: int = 9527
# === 安全 ===
SECRET_KEY: str = "change-me-in-production"
@@ -67,3 +81,7 @@ class Settings(BaseSettings):
settings = Settings()
settings.DATABASE_URL = settings.DATABASE_URL.replace("./data", _resolve_path("./data"), 1)
settings.DATA_DIR = _resolve_path(settings.DATA_DIR)
settings.CHROMA_PERSIST_DIR = _resolve_path(settings.CHROMA_PERSIST_DIR)
settings.UPLOAD_DIR = _resolve_path(settings.UPLOAD_DIR)