mery22 commited on
Commit
a34f27a
·
verified ·
1 Parent(s): e241d15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -85,9 +85,10 @@ def insert_feedback(conn, rating, comment):
85
  cur.execute('INSERT INTO feedback (timestamp, rating, comment) VALUES (%s, %s, %s)',
86
  (timestamp, int(rating), comment))
87
  conn.commit()
88
- st.success("Feedback inserted successfully.")
89
  except Exception as e:
90
  st.error(f"Error inserting feedback: {e}")
 
91
 
92
  # Streamlit interface with improved aesthetics
93
  st.set_page_config(page_title="Alter-IA Chat", page_icon="🤖")
@@ -190,7 +191,8 @@ if submit_button:
190
  else:
191
  # Store feedback in PostgreSQL
192
  conn = create_connection()
193
- insert_feedback(conn, rating, comment)
 
194
  conn.close()
195
 
196
  else:
 
85
  cur.execute('INSERT INTO feedback (timestamp, rating, comment) VALUES (%s, %s, %s)',
86
  (timestamp, int(rating), comment))
87
  conn.commit()
88
+ return True
89
  except Exception as e:
90
  st.error(f"Error inserting feedback: {e}")
91
+ return False
92
 
93
  # Streamlit interface with improved aesthetics
94
  st.set_page_config(page_title="Alter-IA Chat", page_icon="🤖")
 
191
  else:
192
  # Store feedback in PostgreSQL
193
  conn = create_connection()
194
+ if insert_feedback(conn, rating, comment):
195
+ st.success("Thank you for your feedback!")
196
  conn.close()
197
 
198
  else: