Skip to content

Commit

Permalink
hotfix: fix quiz indexing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
muffinsnip committed Dec 10, 2023
1 parent 3f47ac2 commit 5c65684
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/llama/custom_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_quiz_from_intermediate(self, progress, book_content_url, summary_tree_ur
available_summary_list = summary_tree.find_included_summaries(leaf)

content = "\n\n".join([summary.summary_content for summary in available_summary_list])
content += "\n\n" + book_content[leaf.end_idx:word_index]
content += "\n\n" + book_content[leaf.start_idx:word_index]

for resp in self.completion_with_backoff(
model="gpt-4", messages=[
Expand Down
8 changes: 4 additions & 4 deletions backend/routers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class UserSignupRequest(BaseModel):
#TODO:
SECRET_KEY = "your_secret_key" # Use an environment variable or a config file for the real secret
ALGORITHM = "HS256" # Can be HS256 or RS256
ACCESS_TOKEN_EXPIRE_MINUTES = 30
REFRESH_TOKEN_EXPIRE_WEEKS = 2
ACCESS_TOKEN_EXPIRE_WEEKS = 52
REFRESH_TOKEN_EXPIRE_WEEKS = 104

def check_token_expired(token):
decoded_token = jwt.decode(token.replace('"',''), SECRET_KEY, algorithms=[ALGORITHM])
Expand Down Expand Up @@ -181,7 +181,7 @@ def login(form_data: OAuth2PasswordRequestForm = Depends()):
)

token_data = {"sub": email}
access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
access_token_expires = timedelta(weeks=ACCESS_TOKEN_EXPIRE_WEEKS)
access_token = create_jwt_token(
data=token_data, expires_delta=access_token_expires
)
Expand Down Expand Up @@ -258,7 +258,7 @@ def refresh_access_token(refresh_token: str):
print(exc)
raise credentials_exception from exc

access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
access_token_expires = timedelta(weeks=ACCESS_TOKEN_EXPIRE_WEEKS)
new_access_token = create_jwt_token(
data={"sub": email}, expires_delta=access_token_expires
)
Expand Down

0 comments on commit 5c65684

Please sign in to comment.