-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_memory_bridge_write.py
More file actions
32 lines (29 loc) · 1.27 KB
/
Copy pathfix_memory_bridge_write.py
File metadata and controls
32 lines (29 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""Fix memory_bridge.py _write_graph to use gm_nodes table with correct columns."""
with open('memory_bridge.py', 'r', encoding='utf-8') as f:
content = f.read()
# Fix the INSERT in _write_graph
old = ''' """INSERT INTO nodes (type, content, summary, source_file, created_at)
VALUES (?, ?, ?, ?, ?)""",
(etype, content, summary, "tl-ego-server", now_ms)'''
new = ''' """INSERT INTO gm_nodes (type, name, description, content, created_at)
VALUES (?, ?, ?, ?, ?)""",
(etype, name, summary, content, now_ms)'''
if old in content:
content = content.replace(old, new)
with open('memory_bridge.py', 'w', encoding='utf-8') as f:
f.write(content)
print("✅ _write_graph INSERT fixed")
else:
print("⚠️ old pattern not found, checking current state...")
# Show the surrounding lines
idx = content.find("INSERT INTO nodes")
if idx >= 0:
print(content[idx:idx+300])
else:
print("INSERT INTO nodes not found - maybe already fixed?")
# Find INSERT INTO gm_nodes
idx = content.find("INSERT INTO gm_nodes")
if idx >= 0:
print("Already has gm_nodes:")
print(content[idx:idx+300])