vault backup: 2026-02-26 21:10:47
This commit is contained in:
@@ -14,6 +14,7 @@ from index_common import (
|
||||
)
|
||||
|
||||
MIN_TEXT_LEN = 50
|
||||
PRIMARY_DIRS = {'01_Projects', '02_Areas'}
|
||||
|
||||
|
||||
def parse_changes(changes_file: Path) -> list[dict]:
|
||||
@@ -35,11 +36,17 @@ def parse_changes(changes_file: Path) -> list[dict]:
|
||||
|
||||
|
||||
def upsert_file(cur, rel_path: str) -> None:
|
||||
top_dir = Path(rel_path).parts[0] if Path(rel_path).parts else ''
|
||||
if top_dir not in PRIMARY_DIRS:
|
||||
print(f'[SKIPPED-OUT-OF-SCOPE] {rel_path}')
|
||||
return
|
||||
|
||||
abs_path = VAULT_ROOT / rel_path
|
||||
if not abs_path.exists() or abs_path.suffix.lower() != '.md':
|
||||
return
|
||||
|
||||
if is_excluded(abs_path):
|
||||
reason = is_excluded(abs_path)
|
||||
if reason:
|
||||
cur.execute('DELETE FROM memory_primary WHERE id=%s', (rel_path,))
|
||||
cur.execute(
|
||||
'''
|
||||
@@ -49,7 +56,7 @@ def upsert_file(cur, rel_path: str) -> None:
|
||||
risk = EXCLUDED.risk,
|
||||
updated_at = now()
|
||||
''',
|
||||
(rel_path, rel_path, 'excluded_or_sensitive'),
|
||||
(rel_path, rel_path, reason),
|
||||
)
|
||||
print(f'[QUARANTINED] {rel_path}')
|
||||
return
|
||||
@@ -61,6 +68,13 @@ def upsert_file(cur, rel_path: str) -> None:
|
||||
print(f'[PRUNED] {rel_path}')
|
||||
return
|
||||
|
||||
new_hash = sha256_text(text)
|
||||
cur.execute('SELECT content_hash FROM memory_primary WHERE id=%s', (rel_path,))
|
||||
row = cur.fetchone()
|
||||
if row and row[0] == new_hash:
|
||||
print(f'[SKIPPED] {rel_path}')
|
||||
return
|
||||
|
||||
try:
|
||||
embedding = embed_text(text)
|
||||
except Exception as error:
|
||||
|
||||
Reference in New Issue
Block a user