Open SergKam-dev-agent opened 1 month ago
--logs-- Task failed.
Output: ``` ``` Error: ``` AI_RetryError: Failed after 3 attempts. Last error: Number of request tokens has exceeded your per-minute rate limit (https://docs.anthropic.com/en/api/rate-limits); see the response headers for current usage. Please reduce the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase. ```
This subtask is part of issue #15: Create back-end for games
Objective: Implement a system for dynamically fetching game level data to prevent users from seeing next-level data and allow for easy addition of new levels or translations.
Steps:
Create an API route for each game:
Implement logic in these API routes to serve level data based on the requested level.
Store game data in a structured format (e.g., JSON files) in the project, organized by game and level.
In the API routes, read the appropriate data file based on the requested level and return it as a response.
Implement error handling for cases where a requested level doesn't exist.
Update the game components (guess-articles.tsx and german-words-match.tsx) to fetch level data using the new API routes.
Implement a loading state in the game components while data is being fetched.
Use React's useEffect hook to fetch the initial level data when the game component mounts.
Implement a function to fetch the next level's data when a player completes a level.
Create a Context using React's Context API to manage the game state, including current level, score, and fetched data.
Wrap the game components with the created Context provider.
Update the game logic to use the Context for state management.
Deliverables:
Testing:
Resources:
Please commit your changes and create a pull request when complete.