fix: correct sor.R() call pattern - ns dict contains filters+sort

- sor.R signature: R(tablename, ns, filters=None)
- ns (2nd arg) is a combined dict: filter conditions + sort options
- _get_config: user_id filter + sort in single ns dict
- _find_relevant_skills: user_id filter + $or/$like in ns dict
- list_reasoning_sessions: user_id filter + sort in ns dict
- All queries include user_id for multi-user isolation
This commit is contained in:
yumoqing 2026-05-07 17:09:13 +08:00
parent a00465305a
commit c164914738

View File

@ -130,7 +130,7 @@ class HermesReasoningEngine:
where = {}
if user_id:
where['user_id'] = user_id
rows = await sor.R('harnessed_reasoning_config', where if where else None, ns={'sort': 'updated_at desc'})
rows = await sor.R('harnessed_reasoning_config', {'user_id': user_id, 'sort': 'updated_at desc'} if user_id else {'sort': 'updated_at desc'})
if rows:
return rows[0]
except Exception as e:
@ -690,7 +690,7 @@ class HermesReasoningEngine:
try:
async with self.db.sqlorContext('default') as sor:
rows = await sor.R('harnessed_reasoning_sessions', {'user_id': user_id}, ns={'sort': 'created_at desc'})
rows = await sor.R('harnessed_reasoning_sessions', {'user_id': user_id, 'sort': 'created_at desc'})
rows = rows or []
rows = rows[offset:offset + limit]