ChenyuRabbitLove commited on
Commit
9be0fe4
1 Parent(s): 587e7b0

bugfix: fix minor bugs

Browse files
Files changed (1) hide show
  1. utils/completion_reward.py +4 -5
utils/completion_reward.py CHANGED
@@ -171,14 +171,14 @@ class CompletionReward:
171
  f"Player {insert_row['player_backend_user_id']} rendered successfully."
172
  )
173
 
174
- with open("../data/completion_reward_issue_status.json") as f:
175
  completion_reward_issue_status_dict = json.load(f)
176
 
177
  completion_reward_issue_status_dict[
178
  insert_row["player_backend_user_id"]
179
  ] = self.player_certificate_url
180
 
181
- with open("../data/completion_reward_issue_status.json", "w") as f:
182
  json.dump(completion_reward_issue_status_dict, f)
183
 
184
  def upload_blob_and_get_public_url(
@@ -319,14 +319,13 @@ class AWSAgent:
319
 
320
  class GoogleAgent:
321
  def get_story(self, user_log):
322
- credentials, _ = auth.default()
323
- credentials.refresh(Request())
324
 
325
  url = f"https://us-central1-aiplatform.googleapis.com/v1/projects/junyiacademy/locations/us-central1/publishers/google/models/gemini-pro:streamGenerateContent?"
326
 
327
  # Headers
328
  headers = {
329
- "Authorization": f"Bearer {credentials.token}",
330
  "Content-Type": "application/json",
331
  }
332
  system_prompt = """
 
171
  f"Player {insert_row['player_backend_user_id']} rendered successfully."
172
  )
173
 
174
+ with open("./data/completion_reward_issue_status.json") as f:
175
  completion_reward_issue_status_dict = json.load(f)
176
 
177
  completion_reward_issue_status_dict[
178
  insert_row["player_backend_user_id"]
179
  ] = self.player_certificate_url
180
 
181
+ with open("./data/completion_reward_issue_status.json", "w") as f:
182
  json.dump(completion_reward_issue_status_dict, f)
183
 
184
  def upload_blob_and_get_public_url(
 
319
 
320
  class GoogleAgent:
321
  def get_story(self, user_log):
322
+ creds.refresh(Request())
 
323
 
324
  url = f"https://us-central1-aiplatform.googleapis.com/v1/projects/junyiacademy/locations/us-central1/publishers/google/models/gemini-pro:streamGenerateContent?"
325
 
326
  # Headers
327
  headers = {
328
+ "Authorization": f"Bearer {creds.token}",
329
  "Content-Type": "application/json",
330
  }
331
  system_prompt = """