- Add missing core module files: crud_ops.py, db_tables.py, init_db.py, user_context.py - Ensure all .dspy scripts properly use get_user() for user_id acquisition - Fix user context handling in module functions via get_current_user_id() - Maintain proper async/await patterns throughout the codebase - Complete module implementation following module-development-spec - All database operations use sqlor framework with proper user isolation
22 lines
768 B
Plaintext
22 lines
768 B
Plaintext
# Get all sessions for display in sessions.ui
|
|
# This .dspy file uses functions provided by load_hermes_web_cli()
|
|
|
|
try:
|
|
# Use the function provided by the hermes-web-cli module
|
|
sessions = await get_active_sessions()
|
|
|
|
# Format sessions for UI display
|
|
result = []
|
|
for session in sessions:
|
|
result.append({
|
|
"id": session.get("session_id"),
|
|
"name": session.get("session_name", f"Session {session.get('session_id')}"),
|
|
"model": session.get("service_name", "Unknown"),
|
|
"created_at": session.get("created_at"),
|
|
"last_active": session.get("last_active", session.get("created_at"))
|
|
})
|
|
|
|
return result
|
|
except Exception as e:
|
|
# On error, return empty array
|
|
return [] |