Farid Karimli commited on
Commit
05f78f2
·
1 Parent(s): 8402fe0

Google OAuth implement

Browse files
Files changed (1) hide show
  1. code/main.py +8 -9
code/main.py CHANGED
@@ -9,9 +9,6 @@ from modules.config.constants import LLAMA_PATH
9
  from modules.chat.helpers import get_sources
10
  import copy
11
  from typing import Optional
12
- from dotenv import load_dotenv
13
-
14
- load_dotenv()
15
 
16
  USER_TIMEOUT = 60_000
17
  SYSTEM = "System 🖥️"
@@ -285,14 +282,16 @@ class Chatbot:
285
 
286
  await cl.Message(content=answer_with_sources, elements=source_elements).send()
287
 
288
- def auth_callback(self, username: str, password: str) -> Optional[cl.User]:
289
- return cl.User(
290
- identifier=username,
291
- metadata={"role": "admin", "provider": "credentials"},
292
- )
 
 
 
293
 
294
  chatbot = Chatbot()
295
- cl.password_auth_callback(chatbot.auth_callback)
296
  cl.set_starters(chatbot.set_starters)
297
  cl.author_rename(chatbot.rename)
298
  cl.on_chat_start(chatbot.start)
 
9
  from modules.chat.helpers import get_sources
10
  import copy
11
  from typing import Optional
 
 
 
12
 
13
  USER_TIMEOUT = 60_000
14
  SYSTEM = "System 🖥️"
 
282
 
283
  await cl.Message(content=answer_with_sources, elements=source_elements).send()
284
 
285
+ @cl.oauth_callback
286
+ def auth_callback(
287
+ provider_id: str,
288
+ token: str,
289
+ raw_user_data: Dict[str, str],
290
+ default_user: cl.User,
291
+ ) -> Optional[cl.User]:
292
+ return default_user
293
 
294
  chatbot = Chatbot()
 
295
  cl.set_starters(chatbot.set_starters)
296
  cl.author_rename(chatbot.rename)
297
  cl.on_chat_start(chatbot.start)