fix: replace personal filesystem paths with env vars / config

- docker-compose.yml: hardcoded iCloud Obsidian vault volume → ${OMBRE_HOST_VAULT_DIR:-./buckets}
- write_memory.py / migrate_to_domains.py / reclassify_domains.py / reclassify_api.py:
  hardcoded ~/Documents/Obsidian Vault/Ombre Brain → OMBRE_BUCKETS_DIR > load_config() > ./buckets
- write_memory.py: also fix B-04 regression (activation_count: 1 → 0 in frontmatter template)
- reclassify_api.py: model + base_url now read from config (was hardcoded SiliconFlow / DeepSeek-V3)
- tests/dataset.py + test_feel_flow.py: anonymize fixture identifiers (P酱/P0lar1s/北极星 → TestUser/北方)

Project identifiers (git.p0lar1s.uk, p0luz/ombre-brain, P0luz/Ombre-Brain GitHub) intentionally retained as project branding per user decision.
This commit is contained in:
P0luz
2026-04-21 19:53:24 +08:00
parent b869a111c7
commit 38be7610f4
7 changed files with 97 additions and 26 deletions

View File

@@ -12,7 +12,28 @@ import uuid
import argparse
from datetime import datetime
VAULT_DIR = os.path.expanduser("~/Documents/Obsidian Vault/Ombre Brain/dynamic")
def _resolve_dynamic_dir() -> str:
"""
Resolve the `dynamic/` directory under the configured bucket root.
Priority: $OMBRE_BUCKETS_DIR > config.yaml > built-in default.
优先级:环境变量 > config.yaml > 内置默认。
"""
env_dir = os.environ.get("OMBRE_BUCKETS_DIR", "").strip()
if env_dir:
return os.path.join(os.path.expanduser(env_dir), "dynamic")
try:
from utils import load_config # local import to avoid hard dep when missing
cfg = load_config()
return os.path.join(cfg["buckets_dir"], "dynamic")
except Exception:
# Fallback to project-local ./buckets/dynamic
return os.path.join(
os.path.dirname(os.path.abspath(__file__)), "buckets", "dynamic"
)
VAULT_DIR = _resolve_dynamic_dir()
def gen_id():
@@ -36,7 +57,7 @@ def write_memory(
tags_yaml = "\n".join(f"- {t}" for t in tags)
md = f"""---
activation_count: 1
activation_count: 0
arousal: {arousal}
created: '{now}'
domain: