fix: DBPools() not in __init__, sqlorContext uses module name not default
This commit is contained in:
parent
906c037920
commit
ba59b43268
Binary file not shown.
@ -111,7 +111,7 @@ class HermesReasoningEngine:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db = DBPools()
|
pass
|
||||||
|
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
# Config helpers
|
# Config helpers
|
||||||
@ -126,7 +126,8 @@ class HermesReasoningEngine:
|
|||||||
dbname = 'default'
|
dbname = 'default'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with self.db.sqlorContext(dbname) as sor:
|
db = DBPools()
|
||||||
|
async with db.sqlorContext(dbname) as sor:
|
||||||
where = {}
|
where = {}
|
||||||
if user_id:
|
if user_id:
|
||||||
where['user_id'] = user_id
|
where['user_id'] = user_id
|
||||||
@ -196,7 +197,8 @@ class HermesReasoningEngine:
|
|||||||
|
|
||||||
skills = []
|
skills = []
|
||||||
try:
|
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]:
|
for kw in list(keywords)[:3]:
|
||||||
rows = await sor.R('hermes_skills', {
|
rows = await sor.R('hermes_skills', {
|
||||||
'user_id': user_id,
|
'user_id': user_id,
|
||||||
@ -628,7 +630,8 @@ class HermesReasoningEngine:
|
|||||||
'created_at': datetime.now(),
|
'created_at': datetime.now(),
|
||||||
'updated_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)
|
res = await sor.C('harnessed_reasoning_sessions', data)
|
||||||
info(f"Session stored: {session_id}, result={res}")
|
info(f"Session stored: {session_id}, result={res}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -639,7 +642,8 @@ class HermesReasoningEngine:
|
|||||||
async def _update_session_status(self, session_id: str, status: str):
|
async def _update_session_status(self, session_id: str, status: str):
|
||||||
"""Update session status."""
|
"""Update session status."""
|
||||||
try:
|
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', {
|
await sor.U('harnessed_reasoning_sessions', {
|
||||||
'id': session_id,
|
'id': session_id,
|
||||||
'status': status,
|
'status': status,
|
||||||
@ -661,7 +665,8 @@ class HermesReasoningEngine:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with self.db.sqlorContext('default') as sor:
|
db = DBPools()
|
||||||
|
async with db.sqlorContext('harnessed_reasoning') as sor:
|
||||||
filters = {'id': session_id}
|
filters = {'id': session_id}
|
||||||
if user_id:
|
if user_id:
|
||||||
filters['user_id'] = user_id
|
filters['user_id'] = user_id
|
||||||
@ -697,7 +702,8 @@ class HermesReasoningEngine:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
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 = await sor.R('harnessed_reasoning_sessions', {'user_id': user_id, 'sort': 'created_at desc'})
|
||||||
rows = rows or []
|
rows = rows or []
|
||||||
rows = rows[offset:offset + limit]
|
rows = rows[offset:offset + limit]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user