Tuchuanhuhuhu commited on
Commit
cc9e07a
·
1 Parent(s): 6125458

重新支持切换api host

Browse files
Files changed (1) hide show
  1. modules/models.py +1 -3
modules/models.py CHANGED
@@ -30,8 +30,6 @@ class OpenAIClient(BaseLLMModel):
30
  ) -> None:
31
  super().__init__(model_name=model_name, temperature=temperature, top_p=top_p, system_prompt=system_prompt)
32
  self.api_key = api_key
33
- self.completion_url = shared.state.completion_url
34
- self.usage_api_url = shared.state.usage_api_url
35
  self.headers = {
36
  "Content-Type": "application/json",
37
  "Authorization": f"Bearer {self.api_key}",
@@ -68,7 +66,7 @@ class OpenAIClient(BaseLLMModel):
68
  curr_time = datetime.datetime.now()
69
  last_day_of_month = get_last_day_of_month(curr_time).strftime("%Y-%m-%d")
70
  first_day_of_month = curr_time.replace(day=1).strftime("%Y-%m-%d")
71
- usage_url = f"{self.usage_api_url}?start_date={first_day_of_month}&end_date={last_day_of_month}"
72
  try:
73
  usage_data = self._get_billing_data(usage_url)
74
  except Exception as e:
 
30
  ) -> None:
31
  super().__init__(model_name=model_name, temperature=temperature, top_p=top_p, system_prompt=system_prompt)
32
  self.api_key = api_key
 
 
33
  self.headers = {
34
  "Content-Type": "application/json",
35
  "Authorization": f"Bearer {self.api_key}",
 
66
  curr_time = datetime.datetime.now()
67
  last_day_of_month = get_last_day_of_month(curr_time).strftime("%Y-%m-%d")
68
  first_day_of_month = curr_time.replace(day=1).strftime("%Y-%m-%d")
69
+ usage_url = f"{shared.state.usage_api_url}?start_date={first_day_of_month}&end_date={last_day_of_month}"
70
  try:
71
  usage_data = self._get_billing_data(usage_url)
72
  except Exception as e: