diff --git a/wwwroot/hermes-web-cli/sessions/create_session.dspy b/wwwroot/hermes-web-cli/sessions/create_session.dspy index 16160f1..53087aa 100644 --- a/wwwroot/hermes-web-cli/sessions/create_session.dspy +++ b/wwwroot/hermes-web-cli/sessions/create_session.dspy @@ -22,24 +22,21 @@ try: initial_prompt = form_data.get('initial-prompt', '') if not service_id: - return {"error": "Service ID is required", "success": False} + # Redirect back to form with error + await redirect("/hermes-web-cli/new_session.ui?error=Service+ID+is+required") # Use the function provided by the hermes-web-cli module # This will call the remote hermes-service API session_result = create_session(service_id, initial_prompt) if session_result: - # Return success response with session details - return { - "success": True, - "session_id": session_result, - "service_id": service_id, - "redirect_url": f"/hermes-web-cli/sessions/{session_result}" - } + # Redirect to the new session's user interaction page + await redirect(f"/hermes-web-cli/sessions/{session_result}") else: - return {"error": "Failed to create session", "success": False} + # Redirect back to form with error + await redirect("/hermes-web-cli/new_session.ui?error=Failed+to+create+session") except Exception as e: - # Log the error and return failure + # Log the error and redirect back with error message print(f"Error creating session: {str(e)}") - return {"error": f"Internal error: {str(e)}", "success": False} \ No newline at end of file + await redirect(f"/hermes-web-cli/new_session.ui?error=Internal+error:+{str(e)}") \ No newline at end of file