IAMTFRMZA commited on
Commit
32a8ad8
·
verified ·
1 Parent(s): aeed563

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -76,26 +76,27 @@ header {visibility: hidden;}
76
  width: 100%;
77
  background: #191b22;
78
  padding: 0.5em 0.6em;
79
- display: block;
 
 
80
  border-top: 1px solid #22232c;
81
  z-index: 999;
82
  }
83
 
84
- .stChatInputContainer {
85
- position: relative;
 
 
 
 
86
  }
87
 
88
  .clear-chat-btn {
89
- position: absolute;
90
- right: 3em;
91
- top: 50%;
92
- transform: translateY(-50%);
93
  font-size: 1.4em;
94
  color: #ccc;
95
  background: none;
96
  border: none;
97
  cursor: pointer;
98
- z-index: 1000;
99
  }
100
  </style>
101
  """, unsafe_allow_html=True)
@@ -196,16 +197,18 @@ def synthesize_voice(text, voice_key, user_id):
196
  # --- CHAT DISPLAY
197
  display_chat_history()
198
 
199
- # --- Bottom input bar with chat_input() and inline clear
200
  with st.container():
201
  st.markdown('<div class="input-bottom-bar">', unsafe_allow_html=True)
202
 
 
203
  user_input = st.chat_input("Type your message here...")
 
204
 
205
- # Inject clear button
206
- st.markdown("""
207
- <button class="clear-chat-btn" onclick="window.location.href='?clear=1'">🗑️</button>
208
- """, unsafe_allow_html=True)
209
 
210
  st.markdown('</div>', unsafe_allow_html=True)
211
 
@@ -219,10 +222,6 @@ window.onload = function() {
219
  </script>
220
  """, unsafe_allow_html=True)
221
 
222
- # --- Handle clear
223
- if st.query_params.get("clear") == "1":
224
- clear_chat_history()
225
-
226
  # --- Handle user input
227
  if user_input:
228
  thread_id = get_or_create_thread_id()
 
76
  width: 100%;
77
  background: #191b22;
78
  padding: 0.5em 0.6em;
79
+ display: flex;
80
+ align-items: center;
81
+ justify-content: space-between;
82
  border-top: 1px solid #22232c;
83
  z-index: 999;
84
  }
85
 
86
+ .input-bottom-bar .left {
87
+ flex-grow: 1;
88
+ }
89
+
90
+ .input-bottom-bar .right {
91
+ margin-left: 0.5em;
92
  }
93
 
94
  .clear-chat-btn {
 
 
 
 
95
  font-size: 1.4em;
96
  color: #ccc;
97
  background: none;
98
  border: none;
99
  cursor: pointer;
 
100
  }
101
  </style>
102
  """, unsafe_allow_html=True)
 
197
  # --- CHAT DISPLAY
198
  display_chat_history()
199
 
200
+ # --- Bottom input bar with chat_input() and clear button (Option 1)
201
  with st.container():
202
  st.markdown('<div class="input-bottom-bar">', unsafe_allow_html=True)
203
 
204
+ st.markdown('<div class="left">', unsafe_allow_html=True)
205
  user_input = st.chat_input("Type your message here...")
206
+ st.markdown('</div>', unsafe_allow_html=True)
207
 
208
+ st.markdown('<div class="right">', unsafe_allow_html=True)
209
+ if st.button("🗑️", help="Clear Chat", key="clear-chat-bottom"):
210
+ clear_chat_history()
211
+ st.markdown('</div>', unsafe_allow_html=True)
212
 
213
  st.markdown('</div>', unsafe_allow_html=True)
214
 
 
222
  </script>
223
  """, unsafe_allow_html=True)
224
 
 
 
 
 
225
  # --- Handle user input
226
  if user_input:
227
  thread_id = get_or_create_thread_id()