ChenyuRabbitLove commited on
Commit
5094d0c
1 Parent(s): 06d937f

fix/modify get cred function to meet the value type

Browse files
Files changed (2) hide show
  1. utils/chatbot.py +4 -3
  2. utils/gpt_processor.py +0 -1
utils/chatbot.py CHANGED
@@ -80,10 +80,11 @@ class Chatbot:
80
 
81
  def __init_drive_service(self):
82
  SCOPES = ["https://www.googleapis.com/auth/drive"]
83
- SERVICE_ACCOUNT_FILE = os.getenv("CREDENTIALS")
 
84
 
85
- creds = Credentials.from_service_account_file(
86
- SERVICE_ACCOUNT_FILE, scopes=SCOPES
87
  )
88
 
89
  return build("drive", "v3", credentials=creds)
 
80
 
81
  def __init_drive_service(self):
82
  SCOPES = ["https://www.googleapis.com/auth/drive"]
83
+ SERVICE_ACCOUNT_INFO = os.getenv("CREDENTIALS")
84
+ service_account_info_dict = json.loads(SERVICE_ACCOUNT_INFO)
85
 
86
+ creds = Credentials.from_service_account_info(
87
+ service_account_info_dict, scopes=SCOPES
88
  )
89
 
90
  return build("drive", "v3", credentials=creds)
utils/gpt_processor.py CHANGED
@@ -10,7 +10,6 @@ import tiktoken
10
 
11
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
12
 
13
-
14
  class GPTAgent:
15
  def __init__(self, model):
16
  openai.api_key = OPENAI_API_KEY
 
10
 
11
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
12
 
 
13
  class GPTAgent:
14
  def __init__(self, model):
15
  openai.api_key = OPENAI_API_KEY