diff --git a/hermes_web_cli/__pycache__/__init__.cpython-310.pyc b/hermes_web_cli/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..66989cf Binary files /dev/null and b/hermes_web_cli/__pycache__/__init__.cpython-310.pyc differ diff --git a/hermes_web_cli/init.py b/hermes_web_cli/init.py index 254b17a..2bbc243 100644 --- a/hermes_web_cli/init.py +++ b/hermes_web_cli/init.py @@ -134,7 +134,7 @@ def test_service_connection(url: str, apikey: str = "") -> Tuple[bool, str]: return False, f"Error: {str(e)}" # Session management -def create_session(service_id: str, user_message: str = "") -> str: +def create_session(service_id: str, user_id: str, user_message: str = "") -> str: """Create a new session with a Hermes service.""" try: # Get service configuration @@ -158,7 +158,7 @@ def create_session(service_id: str, user_message: str = "") -> str: response = requests.post( f"{service_url.rstrip('/')}/api/v1/sessions", json={ - "user_id": "web-cli-user", # This could be made configurable + "user_id": user_id, "initial_message": user_message if user_message else None }, headers=headers, diff --git a/wwwroot/.new_session.ui.swp b/wwwroot/.new_session.ui.swp deleted file mode 100644 index ce130ed..0000000 Binary files a/wwwroot/.new_session.ui.swp and /dev/null differ diff --git a/wwwroot/sessions/create_session.dspy b/wwwroot/sessions/create_session.dspy index f823af4..0b10a07 100644 --- a/wwwroot/sessions/create_session.dspy +++ b/wwwroot/sessions/create_session.dspy @@ -17,10 +17,12 @@ try: # Redirect back to form with error return {"redirect": "/hermes-web-cli/new_session.ui?error=Service+ID+is+required"} + # Get current user ID using ahserver's built-in get_user() function + user_id = await get_user() + # Use the function provided by the hermes-web-cli module - # This will call the remote hermes-service API - # Pass empty string as initial message since we don't collect it in the form - session_result = create_session(service_id, "") + # This will call the remote hermes-service API with user_id support + session_result = create_session(service_id, user_id, "") if session_result: # Redirect to the new session's user interaction page