Spaces:
Running
Running
Update logger.py
Browse files
logger.py
CHANGED
@@ -1,23 +1,22 @@
|
|
1 |
import firebase_admin
|
2 |
from firebase_admin import credentials, firestore
|
3 |
-
|
4 |
|
5 |
-
#
|
6 |
-
cred = credentials.Certificate("firebase_key.json") #
|
7 |
firebase_admin.initialize_app(cred)
|
8 |
-
|
9 |
db = firestore.client()
|
10 |
|
11 |
-
def
|
12 |
doc = {
|
13 |
-
"timestamp": datetime.utcnow()
|
14 |
"goal": goal,
|
15 |
"solution_1": sol1,
|
16 |
"solution_2": sol2,
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"correct_answer":
|
20 |
-
"
|
21 |
}
|
22 |
-
|
23 |
-
|
|
|
1 |
import firebase_admin
|
2 |
from firebase_admin import credentials, firestore
|
3 |
+
import datetime
|
4 |
|
5 |
+
# Initialize Firebase
|
6 |
+
cred = credentials.Certificate("firebase_key.json") # Change if you renamed the file
|
7 |
firebase_admin.initialize_app(cred)
|
|
|
8 |
db = firestore.client()
|
9 |
|
10 |
+
def log_feedback_to_firebase(goal, sol1, sol2, evo_response, gpt_response, correct_answer, user_feedback):
|
11 |
doc = {
|
12 |
+
"timestamp": datetime.datetime.utcnow(),
|
13 |
"goal": goal,
|
14 |
"solution_1": sol1,
|
15 |
"solution_2": sol2,
|
16 |
+
"evo_response": evo_response,
|
17 |
+
"gpt_response": gpt_response,
|
18 |
+
"correct_answer": correct_answer,
|
19 |
+
"user_feedback": user_feedback,
|
20 |
}
|
21 |
+
db.collection("evo_feedback_logs").add(doc)
|
22 |
+
print("✅ Logged to Firestore.")
|