File size: 754 Bytes
8e0fcfe
 
2c69375
e42fcaf
2c69375
 
8e0fcfe
 
 
2c69375
8e0fcfe
2c69375
e42fcaf
 
 
2c69375
 
 
 
e42fcaf
2c69375
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import firebase_admin
from firebase_admin import credentials, firestore
import datetime

# Initialize Firebase
cred = credentials.Certificate("firebase_key.json")  # Change if you renamed the file
firebase_admin.initialize_app(cred)
db = firestore.client()

def log_feedback_to_firebase(goal, sol1, sol2, evo_response, gpt_response, correct_answer, user_feedback):
    doc = {
        "timestamp": datetime.datetime.utcnow(),
        "goal": goal,
        "solution_1": sol1,
        "solution_2": sol2,
        "evo_response": evo_response,
        "gpt_response": gpt_response,
        "correct_answer": correct_answer,
        "user_feedback": user_feedback,
    }
    db.collection("evo_feedback_logs").add(doc)
    print("✅ Logged to Firestore.")