IAMTFRMZA commited on
Commit
6c20c0d
·
verified ·
1 Parent(s): 0b0487b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -30
app.py CHANGED
@@ -66,13 +66,13 @@ header {visibility: hidden;}
66
 
67
  .chat-history-wrapper {
68
  margin-top: 0.5em;
69
- padding-bottom: 7em;
70
  min-height: 60vh;
71
  }
72
 
73
  .input-bottom-bar {
74
  position: fixed;
75
- bottom: 0;
76
  width: 100%;
77
  background: #191b22;
78
  padding: 0.5em 0.6em;
@@ -83,16 +83,6 @@ header {visibility: hidden;}
83
  z-index: 999;
84
  }
85
 
86
- .input-bottom-bar input {
87
- width: 100%;
88
- font-size: 1.1em;
89
- padding: 0.5em;
90
- border-radius: 8px;
91
- border: 1px solid #333;
92
- background: #222;
93
- color: #fff;
94
- }
95
-
96
  #clear-chat {
97
  background: none;
98
  border: none;
@@ -199,19 +189,14 @@ def synthesize_voice(text, voice_key, user_id):
199
  # --- CHAT DISPLAY
200
  display_chat_history()
201
 
202
- # --- Input Form (bottom)
203
- st.markdown("""
204
- <div class="input-bottom-bar">
205
- <div style="flex: 8 1 auto;">
206
- <form action="" method="GET">
207
- <input type="text" name="user_input" id="user-input" placeholder="Type your message here..." />
208
- </form>
209
- </div>
210
- <div style="flex: 2 0 auto; text-align: center;">
211
- <button id="clear-chat" onclick="window.location.href='?clear=1'">🗑️</button>
212
- </div>
213
- </div>
214
- """, unsafe_allow_html=True)
215
 
216
  # --- JS auto-scroll
217
  st.markdown("""
@@ -223,12 +208,7 @@ window.onload = function() {
223
  </script>
224
  """, unsafe_allow_html=True)
225
 
226
- # --- Handle clear
227
- if st.query_params.get("clear") == "1":
228
- clear_chat_history()
229
-
230
  # --- Handle user input
231
- user_input = st.query_params.get("user_input")
232
  if user_input:
233
  thread_id = get_or_create_thread_id()
234
  client.beta.threads.messages.create(thread_id=thread_id, role="user", content=user_input)
 
66
 
67
  .chat-history-wrapper {
68
  margin-top: 0.5em;
69
+ padding-bottom: 9em; /* enough space so input does not cover messages */
70
  min-height: 60vh;
71
  }
72
 
73
  .input-bottom-bar {
74
  position: fixed;
75
+ bottom: 3.5em; /* move up for widget space */
76
  width: 100%;
77
  background: #191b22;
78
  padding: 0.5em 0.6em;
 
83
  z-index: 999;
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
86
  #clear-chat {
87
  background: none;
88
  border: none;
 
189
  # --- CHAT DISPLAY
190
  display_chat_history()
191
 
192
+ # --- Bottom input bar with chat_input() and clear
193
+ with st.container():
194
+ st.markdown('<div class="input-bottom-bar">', unsafe_allow_html=True)
195
+ col1, col2 = st.columns([8, 2])
196
+ user_input = col1.chat_input("Type your message here...")
197
+ if col2.button("🗑️", help="Clear Chat", key="clear-chat-bottom"):
198
+ clear_chat_history()
199
+ st.markdown('</div>', unsafe_allow_html=True)
 
 
 
 
 
200
 
201
  # --- JS auto-scroll
202
  st.markdown("""
 
208
  </script>
209
  """, unsafe_allow_html=True)
210
 
 
 
 
 
211
  # --- Handle user input
 
212
  if user_input:
213
  thread_id = get_or_create_thread_id()
214
  client.beta.threads.messages.create(thread_id=thread_id, role="user", content=user_input)