Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -72,23 +72,30 @@ header {visibility: hidden;}
|
|
72 |
|
73 |
.input-bottom-bar {
|
74 |
position: fixed;
|
75 |
-
bottom: 3.5em;
|
76 |
width: 100%;
|
77 |
background: #191b22;
|
78 |
padding: 0.5em 0.6em;
|
79 |
-
display:
|
80 |
-
align-items: center;
|
81 |
-
gap: 0.5em;
|
82 |
border-top: 1px solid #22232c;
|
83 |
z-index: 999;
|
84 |
}
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
background: none;
|
88 |
border: none;
|
89 |
-
font-size: 1.5em;
|
90 |
-
color: #ccc;
|
91 |
cursor: pointer;
|
|
|
92 |
}
|
93 |
</style>
|
94 |
""", unsafe_allow_html=True)
|
@@ -189,13 +196,17 @@ def synthesize_voice(text, voice_key, user_id):
|
|
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 |
-
|
196 |
-
user_input =
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
199 |
st.markdown('</div>', unsafe_allow_html=True)
|
200 |
|
201 |
# --- JS auto-scroll
|
@@ -208,6 +219,10 @@ window.onload = function() {
|
|
208 |
</script>
|
209 |
""", unsafe_allow_html=True)
|
210 |
|
|
|
|
|
|
|
|
|
211 |
# --- Handle user input
|
212 |
if user_input:
|
213 |
thread_id = get_or_create_thread_id()
|
|
|
72 |
|
73 |
.input-bottom-bar {
|
74 |
position: fixed;
|
75 |
+
bottom: 3.5em;
|
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 |
# --- 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 |
|
212 |
# --- JS auto-scroll
|
|
|
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()
|