tfrere commited on
Commit
0146535
·
1 Parent(s): 8e4efa5
Files changed (1) hide show
  1. server/server.py +7 -1
server/server.py CHANGED
@@ -39,7 +39,13 @@ app.add_middleware(
39
 
40
  # Initialize game components
41
  game_state = GameState()
42
- story_generator = StoryGenerator(api_key=os.getenv("MISTRAL_API_KEY"))
 
 
 
 
 
 
43
 
44
  class Choice(BaseModel):
45
  id: int
 
39
 
40
  # Initialize game components
41
  game_state = GameState()
42
+
43
+ # Check for API key
44
+ mistral_api_key = os.getenv("MISTRAL_API_KEY")
45
+ if not mistral_api_key:
46
+ raise ValueError("MISTRAL_API_KEY environment variable is not set")
47
+
48
+ story_generator = StoryGenerator(api_key=mistral_api_key)
49
 
50
  class Choice(BaseModel):
51
  id: int