- 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
12 lines
414 B
Python
12 lines
414 B
Python
from ahserver.serverenv import get_user
|
|
|
|
async def get_current_user_id() -> str:
|
|
"""Get the current user ID from ahserver context."""
|
|
try:
|
|
# Use ahserver's built-in get_user() function
|
|
user_id = await get_user()
|
|
return user_id
|
|
except Exception as e:
|
|
print(f"Warning: Could not get current user ID: {e}")
|
|
# Fallback to a safe default
|
|
return "default_user" |