Update memory/database.py
Browse files- memory/database.py +6 -4
memory/database.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import sqlite3
|
2 |
import os
|
3 |
|
@@ -5,8 +7,8 @@ DB_PATH = os.path.join("/tmp", "memory.db")
|
|
5 |
|
6 |
def init_db():
|
7 |
conn = sqlite3.connect(DB_PATH)
|
8 |
-
|
9 |
-
|
10 |
CREATE TABLE IF NOT EXISTS agent_logs (
|
11 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
12 |
agent TEXT,
|
@@ -20,8 +22,8 @@ def init_db():
|
|
20 |
|
21 |
def log_action(agent: str, action: str, result: str):
|
22 |
conn = sqlite3.connect(DB_PATH)
|
23 |
-
|
24 |
-
|
25 |
"INSERT INTO agent_logs (agent, action, result) VALUES (?, ?, ?)",
|
26 |
(agent, action, result)
|
27 |
)
|
|
|
1 |
+
# memory/database.py
|
2 |
+
|
3 |
import sqlite3
|
4 |
import os
|
5 |
|
|
|
7 |
|
8 |
def init_db():
|
9 |
conn = sqlite3.connect(DB_PATH)
|
10 |
+
cursor = conn.cursor()
|
11 |
+
cursor.execute("""
|
12 |
CREATE TABLE IF NOT EXISTS agent_logs (
|
13 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
14 |
agent TEXT,
|
|
|
22 |
|
23 |
def log_action(agent: str, action: str, result: str):
|
24 |
conn = sqlite3.connect(DB_PATH)
|
25 |
+
cursor = conn.cursor()
|
26 |
+
cursor.execute(
|
27 |
"INSERT INTO agent_logs (agent, action, result) VALUES (?, ?, ?)",
|
28 |
(agent, action, result)
|
29 |
)
|