fix: replace invalid sor.R(orderby/limit) calls with sqlExe
- Config lookup uses raw SQL for ordering - Skill search uses raw SQL for and limit - Session listing uses raw SQL for order/limit/offset
This commit is contained in:
parent
c36477c9cb
commit
bb420a6471
Binary file not shown.
@ -127,8 +127,8 @@ class HermesReasoningEngine:
|
||||
|
||||
try:
|
||||
async with self.db.sqlorContext(dbname) as sor:
|
||||
rows = await sor.R('harnessed_reasoning_config', {},
|
||||
orderby='updated_at DESC', limit=1)
|
||||
sql = "SELECT * FROM harnessed_reasoning_config ORDER BY updated_at DESC LIMIT 1"
|
||||
rows = await sor.sqlExe(sql, {})
|
||||
if rows:
|
||||
return rows[0]
|
||||
except Exception as e:
|
||||
@ -196,13 +196,15 @@ class HermesReasoningEngine:
|
||||
try:
|
||||
async with self.db.sqlorContext('default') as sor:
|
||||
for kw in list(keywords)[:3]:
|
||||
rows = await sor.R('hermes_skills', {
|
||||
sql = """SELECT * FROM hermes_skills
|
||||
WHERE user_id = :user_id
|
||||
AND (name LIKE :kw1 OR description LIKE :kw2)
|
||||
LIMIT 2"""
|
||||
rows = await sor.sqlExe(sql, {
|
||||
'user_id': user_id,
|
||||
'$or': [
|
||||
{'name': {'$like': f'%{kw}%'}},
|
||||
{'description': {'$like': f'%{kw}%'}},
|
||||
]
|
||||
}, limit=2)
|
||||
'kw1': f'%{kw}%',
|
||||
'kw2': f'%{kw}%'
|
||||
})
|
||||
skills.extend(rows)
|
||||
|
||||
# Deduplicate
|
||||
@ -687,9 +689,8 @@ class HermesReasoningEngine:
|
||||
|
||||
try:
|
||||
async with self.db.sqlorContext('default') as sor:
|
||||
rows = await sor.R('harnessed_reasoning_sessions',
|
||||
{'user_id': user_id},
|
||||
orderby='created_at DESC', limit=limit, offset=offset)
|
||||
sql = f"SELECT * FROM harnessed_reasoning_sessions WHERE user_id = :user_id ORDER BY created_at DESC LIMIT {limit} OFFSET {offset}"
|
||||
rows = await sor.sqlExe(sql, {'user_id': user_id})
|
||||
|
||||
sessions = []
|
||||
for s in rows:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user