Rename memory/database.py to temp/database.py
Browse files
{memory → temp}/database.py
RENAMED
@@ -1,7 +1,11 @@
|
|
1 |
import sqlite3
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def init_db():
|
4 |
-
conn = sqlite3.connect(
|
5 |
cursor = conn.cursor()
|
6 |
cursor.execute(
|
7 |
"""CREATE TABLE IF NOT EXISTS agent_logs (
|
@@ -16,7 +20,7 @@ def init_db():
|
|
16 |
conn.close()
|
17 |
|
18 |
def log_action(agent, action, result):
|
19 |
-
conn = sqlite3.connect(
|
20 |
cursor = conn.cursor()
|
21 |
cursor.execute(
|
22 |
"INSERT INTO agent_logs (agent, action, result) VALUES (?, ?, ?)",
|
|
|
1 |
import sqlite3
|
2 |
+
import os
|
3 |
+
|
4 |
+
# Define safe path for Hugging Face Docker environment
|
5 |
+
DB_PATH = os.path.join("/tmp", "memory.db")
|
6 |
|
7 |
def init_db():
|
8 |
+
conn = sqlite3.connect(DB_PATH)
|
9 |
cursor = conn.cursor()
|
10 |
cursor.execute(
|
11 |
"""CREATE TABLE IF NOT EXISTS agent_logs (
|
|
|
20 |
conn.close()
|
21 |
|
22 |
def log_action(agent, action, result):
|
23 |
+
conn = sqlite3.connect(DB_PATH)
|
24 |
cursor = conn.cursor()
|
25 |
cursor.execute(
|
26 |
"INSERT INTO agent_logs (agent, action, result) VALUES (?, ?, ?)",
|