Update firebase_config.py
Browse files- firebase_config.py +8 -1
firebase_config.py
CHANGED
@@ -17,13 +17,17 @@ cred = credentials.Certificate({
|
|
17 |
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
18 |
"token_uri": "https://oauth2.googleapis.com/token",
|
19 |
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
20 |
-
"client_x509_cert_url": os.getenv("FIREBASE_CLIENT_X509_CERT_URL")
|
|
|
21 |
})
|
22 |
firebase_admin.initialize_app(cred, {
|
23 |
'databaseURL': os.getenv("FIREBASE_DATABASE_URL")
|
24 |
})
|
25 |
|
26 |
def save_chat_message(user_input, krishna_response):
|
|
|
|
|
|
|
27 |
ref = db.reference('chat_history')
|
28 |
ref.push({
|
29 |
'user': user_input,
|
@@ -31,6 +35,9 @@ def save_chat_message(user_input, krishna_response):
|
|
31 |
})
|
32 |
|
33 |
def get_chat_history():
|
|
|
|
|
|
|
34 |
ref = db.reference('chat_history')
|
35 |
history = ref.get()
|
36 |
if history:
|
|
|
17 |
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
18 |
"token_uri": "https://oauth2.googleapis.com/token",
|
19 |
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
20 |
+
"client_x509_cert_url": os.getenv("FIREBASE_CLIENT_X509_CERT_URL"),
|
21 |
+
"universe_domain": "googleapis.com"
|
22 |
})
|
23 |
firebase_admin.initialize_app(cred, {
|
24 |
'databaseURL': os.getenv("FIREBASE_DATABASE_URL")
|
25 |
})
|
26 |
|
27 |
def save_chat_message(user_input, krishna_response):
|
28 |
+
"""
|
29 |
+
Save a chat message to Firebase Realtime Database.
|
30 |
+
"""
|
31 |
ref = db.reference('chat_history')
|
32 |
ref.push({
|
33 |
'user': user_input,
|
|
|
35 |
})
|
36 |
|
37 |
def get_chat_history():
|
38 |
+
"""
|
39 |
+
Retrieve chat history from Firebase Realtime Database.
|
40 |
+
"""
|
41 |
ref = db.reference('chat_history')
|
42 |
history = ref.get()
|
43 |
if history:
|