Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Commit 
							
							·
						
						cecacb2
	
1
								Parent(s):
							
							7a4fa7e
								
Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -58,6 +58,17 @@ if user_input: | |
| 58 | 
             
                r, t = message["role"], message["parts"][0]["text"]
         | 
| 59 | 
             
                st.markdown(f"**{r.title()}:** {t}")
         | 
| 60 |  | 
| 61 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 62 |  | 
| 63 | 
             
            conn.close()
         | 
|  | |
| 58 | 
             
                r, t = message["role"], message["parts"][0]["text"]
         | 
| 59 | 
             
                st.markdown(f"**{r.title()}:** {t}")
         | 
| 60 |  | 
| 61 | 
            +
            if st.button("Display History"):
         | 
| 62 | 
            +
                c.execute("SELECT * FROM history")
         | 
| 63 | 
            +
                rows = c.fetchall()
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                for row in rows:
         | 
| 66 | 
            +
                    st.markdown(f"**{row[0].title()}:** {row[1]}")
         | 
| 67 | 
            +
                    
         | 
| 68 | 
            +
            # Save chat history to database
         | 
| 69 | 
            +
            for message in chat_history:
         | 
| 70 | 
            +
                c.execute("INSERT INTO history VALUES (?, ?)", 
         | 
| 71 | 
            +
                        (message["role"], message["parts"][0]["text"])) 
         | 
| 72 | 
            +
                conn.commit() 
         | 
| 73 |  | 
| 74 | 
             
            conn.close()
         |