italoribeiro commited on
Commit
31ed3c0
1 Parent(s): deff4e2

add email to feedback

Browse files
Files changed (1) hide show
  1. app/main.py +5 -3
app/main.py CHANGED
@@ -41,6 +41,7 @@ class TextWithAspects(BaseModel):
41
  aspects: list = ["quality", "clarity", "organization", "credibility", "emotional_polarity", "emotional_intensity"]
42
 
43
  class FeedbackItem(BaseModel):
 
44
  text: str
45
  timestamp: datetime = Field(default_factory=datetime.utcnow)
46
 
@@ -62,9 +63,10 @@ async def get_text_classification_by_aspects(request: TextWithAspects):
62
 
63
  @app.post("/argq/feedback")
64
  async def post_feedback(item: FeedbackItem):
65
- feedback_data = item.dict()
66
- feedback_data['timestamp'] = feedback_data['timestamp'].isoformat()
67
- doc_ref = db.collection('feedback').document()
 
68
  doc_ref.set(feedback_data)
69
  return {"status": "success", "feedback_received": feedback_data}
70
 
 
41
  aspects: list = ["quality", "clarity", "organization", "credibility", "emotional_polarity", "emotional_intensity"]
42
 
43
  class FeedbackItem(BaseModel):
44
+ email: str
45
  text: str
46
  timestamp: datetime = Field(default_factory=datetime.utcnow)
47
 
 
63
 
64
  @app.post("/argq/feedback")
65
  async def post_feedback(item: FeedbackItem):
66
+ feedback_data = item.model_dump()
67
+ now = datetime.now()
68
+ doc_name = now.strftime("%Y%m%d_%H%M%S")
69
+ doc_ref = db.collection('feedback').document(doc_name)
70
  doc_ref.set(feedback_data)
71
  return {"status": "success", "feedback_received": feedback_data}
72