hhhwmws commited on
Commit
cc9573e
1 Parent(s): e54c48c

Update src/ZhipuClient.py

Browse files
Files changed (1) hide show
  1. src/ZhipuClient.py +11 -11
src/ZhipuClient.py CHANGED
@@ -3,18 +3,18 @@ import os
3
 
4
  class ZhipuClient:
5
  def __init__(self, api_key_file_path = None):
6
- if api_key_file_path is None:
7
- cands = ['./datas/zhipu_key.txt', '../datas/zhipu_key.txt']
8
- flag = False
9
- for cand in cands:
10
- if os.path.exists(cand):
11
- api_key_file_path = cand
12
- flag = True
13
- break
14
- if not flag:
15
- raise ValueError("No valid api key file found.")
16
 
17
- self.api_key = self._load_access_token(api_key_file_path)
18
  self.client = ZhipuAI(api_key=self.api_key)
19
 
20
  def _load_access_token(self, file_path):
 
3
 
4
  class ZhipuClient:
5
  def __init__(self, api_key_file_path = None):
6
+ # if api_key_file_path is None:
7
+ # cands = ['./datas/zhipu_key.txt', '../datas/zhipu_key.txt']
8
+ # flag = False
9
+ # for cand in cands:
10
+ # if os.path.exists(cand):
11
+ # api_key_file_path = cand
12
+ # flag = True
13
+ # break
14
+ # if not flag:
15
+ # raise ValueError("No valid api key file found.")
16
 
17
+ self.api_key = os.getenv("ZHIPU_4_API")
18
  self.client = ZhipuAI(api_key=self.api_key)
19
 
20
  def _load_access_token(self, file_path):