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:
@@ -38,7 +38,11 @@ ANALYZE_PROMPT = (
|
||||
'}'
|
||||
)
|
||||
|
||||
DATA_DIR = "/data/dynamic"
|
||||
DATA_DIR = os.path.join(
|
||||
os.environ.get("OMBRE_BUCKETS_DIR", "").strip()
|
||||
or (lambda: __import__("utils").load_config()["buckets_dir"])(),
|
||||
"dynamic",
|
||||
)
|
||||
UNCLASS_DIR = os.path.join(DATA_DIR, "未分类")
|
||||
|
||||
|
||||
@@ -48,11 +52,15 @@ def sanitize(name):
|
||||
|
||||
|
||||
async def reclassify():
|
||||
from utils import load_config
|
||||
cfg = load_config()
|
||||
dehy = cfg.get("dehydration", {})
|
||||
client = AsyncOpenAI(
|
||||
api_key=os.environ.get("OMBRE_API_KEY", ""),
|
||||
base_url="https://api.siliconflow.cn/v1",
|
||||
api_key=os.environ.get("OMBRE_API_KEY", "") or dehy.get("api_key", ""),
|
||||
base_url=dehy.get("base_url", "https://api.deepseek.com/v1"),
|
||||
timeout=60.0,
|
||||
)
|
||||
model_name = dehy.get("model", "deepseek-chat")
|
||||
|
||||
files = sorted(glob.glob(os.path.join(UNCLASS_DIR, "*.md")))
|
||||
print(f"找到 {len(files)} 个未分类文件\n")
|
||||
@@ -66,7 +74,7 @@ async def reclassify():
|
||||
|
||||
try:
|
||||
resp = await client.chat.completions.create(
|
||||
model="deepseek-ai/DeepSeek-V3",
|
||||
model=model_name,
|
||||
messages=[
|
||||
{"role": "system", "content": ANALYZE_PROMPT},
|
||||
{"role": "user", "content": full_text[:2000]},
|
||||
|
||||
Reference in New Issue
Block a user