pgits Claude commited on
Commit
b2e61ec
·
1 Parent(s): db76a3a

Fix JWT session creation causing 500 errors

Browse files

Fix session creation workflow:
- Store session data in JWT session manager after creation
- Update get_session to check stored session data
- Prevent 500 errors when creating new sessions

Resolves 'Failed to create session' 500 errors in frontend

v1.0.9

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app/core/jwt_session.py +10 -2
app/core/jwt_session.py CHANGED
@@ -46,12 +46,20 @@ class JWTSessionManager:
46
  "conversation_started": False
47
  }
48
 
49
- # Return the session ID (JWT token will be created when needed)
 
 
 
50
  return session_id
51
 
52
  def get_session(self, session_id: str) -> Optional[Dict]:
53
  """Retrieve session data (for compatibility - JWT will be handled at API level)."""
54
- # This will be overridden to work with JWT tokens at the API level
 
 
 
 
 
55
  if session_id in self.conversations:
56
  return {
57
  "session_id": session_id,
 
46
  "conversation_started": False
47
  }
48
 
49
+ # Store the session data for retrieval
50
+ self.session_data = getattr(self, 'session_data', {})
51
+ self.session_data[session_id] = session_data
52
+
53
  return session_id
54
 
55
  def get_session(self, session_id: str) -> Optional[Dict]:
56
  """Retrieve session data (for compatibility - JWT will be handled at API level)."""
57
+ # Check stored session data first
58
+ session_data_store = getattr(self, 'session_data', {})
59
+ if session_id in session_data_store:
60
+ return session_data_store[session_id]
61
+
62
+ # Fallback: check if conversation exists
63
  if session_id in self.conversations:
64
  return {
65
  "session_id": session_id,