diff --git a/harnessed_reasoning/__pycache__/core.cpython-311.pyc b/harnessed_reasoning/__pycache__/core.cpython-311.pyc index 8ee1b11..953f1d6 100644 Binary files a/harnessed_reasoning/__pycache__/core.cpython-311.pyc and b/harnessed_reasoning/__pycache__/core.cpython-311.pyc differ diff --git a/harnessed_reasoning/core.py b/harnessed_reasoning/core.py index 2fadc63..708f78f 100644 --- a/harnessed_reasoning/core.py +++ b/harnessed_reasoning/core.py @@ -111,7 +111,7 @@ class HermesReasoningEngine: } def __init__(self): - self.db = DBPools() + pass # -------------------------------------------------------- # Config helpers @@ -126,7 +126,8 @@ class HermesReasoningEngine: dbname = 'default' try: - async with self.db.sqlorContext(dbname) as sor: + db = DBPools() + async with db.sqlorContext(dbname) as sor: where = {} if user_id: where['user_id'] = user_id @@ -196,7 +197,8 @@ class HermesReasoningEngine: skills = [] try: - async with self.db.sqlorContext('default') as sor: + db = DBPools() + async with db.sqlorContext('harnessed_reasoning') as sor: for kw in list(keywords)[:3]: rows = await sor.R('hermes_skills', { 'user_id': user_id, @@ -628,7 +630,8 @@ class HermesReasoningEngine: 'created_at': datetime.now(), 'updated_at': datetime.now(), } - async with self.db.sqlorContext('default') as sor: + db = DBPools() + async with db.sqlorContext('harnessed_reasoning') as sor: res = await sor.C('harnessed_reasoning_sessions', data) info(f"Session stored: {session_id}, result={res}") except Exception as e: @@ -639,7 +642,8 @@ class HermesReasoningEngine: async def _update_session_status(self, session_id: str, status: str): """Update session status.""" try: - async with self.db.sqlorContext('default') as sor: + db = DBPools() + async with db.sqlorContext('harnessed_reasoning') as sor: await sor.U('harnessed_reasoning_sessions', { 'id': session_id, 'status': status, @@ -661,7 +665,8 @@ class HermesReasoningEngine: pass try: - async with self.db.sqlorContext('default') as sor: + db = DBPools() + async with db.sqlorContext('harnessed_reasoning') as sor: filters = {'id': session_id} if user_id: filters['user_id'] = user_id @@ -697,7 +702,8 @@ class HermesReasoningEngine: pass try: - async with self.db.sqlorContext('default') as sor: + db = DBPools() + async with db.sqlorContext('harnessed_reasoning') as sor: rows = await sor.R('harnessed_reasoning_sessions', {'user_id': user_id, 'sort': 'created_at desc'}) rows = rows or [] rows = rows[offset:offset + limit]