IAMTFRMZA commited on
Commit
26fe6ac
·
verified ·
1 Parent(s): e3583dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -14,7 +14,7 @@ st.set_page_config(page_title="Carfind.co.za AI Assistant", layout="wide")
14
  st.title("🚗 Carfind.co.za AI Assistant")
15
  st.caption("Chat with Carfind.co.za and find your next car fast")
16
 
17
- # Custom CSS for scrollable chat container
18
  st.markdown(
19
  """
20
  <style>
@@ -25,6 +25,17 @@ st.markdown(
25
  border-radius: 10px;
26
  border: 1px solid #444;
27
  background-color: #111;
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
  .element-container:has(> .stChatMessage) {
30
  margin-bottom: 20px;
@@ -68,16 +79,12 @@ else:
68
  st.markdown(message["content"], unsafe_allow_html=True)
69
  st.markdown('</div>', unsafe_allow_html=True)
70
 
71
- # Input and clear button
72
- col_input, col_clear = st.columns([8, 1])
73
 
74
- with col_input:
75
- user_input = st.chat_input("Type your message here...")
76
-
77
- with col_clear:
78
- if st.button("🗑️", help="Clear chat"):
79
- st.session_state.messages = []
80
- st.rerun()
81
 
82
  if openai_key:
83
  client = OpenAI(api_key=openai_key)
 
14
  st.title("🚗 Carfind.co.za AI Assistant")
15
  st.caption("Chat with Carfind.co.za and find your next car fast")
16
 
17
+ # Custom CSS to fix the chat input at the bottom and make chat scrollable above it
18
  st.markdown(
19
  """
20
  <style>
 
25
  border-radius: 10px;
26
  border: 1px solid #444;
27
  background-color: #111;
28
+ margin-bottom: 80px;
29
+ }
30
+ .stChatInputContainer {
31
+ position: fixed;
32
+ bottom: 20px;
33
+ width: 80%;
34
+ left: 10%;
35
+ background-color: #222;
36
+ padding: 10px;
37
+ border-radius: 10px;
38
+ box-shadow: 0 0 15px rgba(0,0,0,0.5);
39
  }
40
  .element-container:has(> .stChatMessage) {
41
  margin-bottom: 20px;
 
79
  st.markdown(message["content"], unsafe_allow_html=True)
80
  st.markdown('</div>', unsafe_allow_html=True)
81
 
82
+ # Input field fixed at the bottom
83
+ user_input = st.chat_input("Type your message here...")
84
 
85
+ if st.button("🗑️ Clear Chat", help="Clear chat history"):
86
+ st.session_state.messages = []
87
+ st.rerun()
 
 
 
 
88
 
89
  if openai_key:
90
  client = OpenAI(api_key=openai_key)