fix: DBPools(config.databases) instead of DBPools() for subprocess context
This commit is contained in:
parent
ba59b43268
commit
8d233f7dcc
BIN
harnessed_reasoning/.init.py.swp
Normal file
BIN
harnessed_reasoning/.init.py.swp
Normal file
Binary file not shown.
Binary file not shown.
@ -13,6 +13,7 @@ try:
|
|||||||
from ahserver.serverenv import ServerEnv
|
from ahserver.serverenv import ServerEnv
|
||||||
from sqlor.dbpools import DBPools
|
from sqlor.dbpools import DBPools
|
||||||
from appPublic.log import info, debug, warning, error, exception
|
from appPublic.log import info, debug, warning, error, exception
|
||||||
|
from appPublic.jsonConfig import getConfig
|
||||||
except ImportError:
|
except ImportError:
|
||||||
class ServerEnv:
|
class ServerEnv:
|
||||||
pass
|
pass
|
||||||
@ -126,7 +127,8 @@ class HermesReasoningEngine:
|
|||||||
dbname = 'default'
|
dbname = 'default'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
where = {}
|
where = {}
|
||||||
if user_id:
|
if user_id:
|
||||||
@ -197,7 +199,8 @@ class HermesReasoningEngine:
|
|||||||
|
|
||||||
skills = []
|
skills = []
|
||||||
try:
|
try:
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext('harnessed_reasoning') as sor:
|
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', {
|
||||||
@ -630,7 +633,8 @@ class HermesReasoningEngine:
|
|||||||
'created_at': datetime.now(),
|
'created_at': datetime.now(),
|
||||||
'updated_at': datetime.now(),
|
'updated_at': datetime.now(),
|
||||||
}
|
}
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext('harnessed_reasoning') as sor:
|
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}")
|
||||||
@ -642,7 +646,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:
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext('harnessed_reasoning') as sor:
|
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,
|
||||||
@ -665,7 +670,8 @@ class HermesReasoningEngine:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext('harnessed_reasoning') as sor:
|
async with db.sqlorContext('harnessed_reasoning') as sor:
|
||||||
filters = {'id': session_id}
|
filters = {'id': session_id}
|
||||||
if user_id:
|
if user_id:
|
||||||
@ -702,7 +708,8 @@ class HermesReasoningEngine:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db = DBPools()
|
config = getConfig()
|
||||||
|
db = DBPools(config.databases)
|
||||||
async with db.sqlorContext('harnessed_reasoning') as sor:
|
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 []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user