Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,9 +57,25 @@ header {visibility: hidden;}
|
|
| 57 |
display: block;
|
| 58 |
}
|
| 59 |
.lor-brand-bar {
|
| 60 |
-
width: 100vw;
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
.stChatMessage { max-width: 85%; border-radius: 12px; padding: 8px; margin-bottom: 10px; }
|
| 64 |
.stChatMessage[data-testid="stChatMessage-user"] { background: #f0f0f0; color: #000000; }
|
| 65 |
.stChatMessage[data-testid="stChatMessage-assistant"] { background: #e3f2fd; color: #000000; }
|
|
@@ -76,36 +92,18 @@ header {visibility: hidden;}
|
|
| 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)
|
| 103 |
|
| 104 |
-
# --- Branding
|
| 105 |
st.markdown("""
|
| 106 |
<div class="lor-brand-bar">
|
| 107 |
<img src="https://lortechnologies.com/wp-content/uploads/2023/03/LOR-Online-Logo.svg" class="logo-mini" />
|
| 108 |
<div style="font-size: 13px; color: #888;">Powered by LOR Technologies</div>
|
|
|
|
| 109 |
</div>
|
| 110 |
""", unsafe_allow_html=True)
|
| 111 |
|
|
@@ -197,20 +195,11 @@ def synthesize_voice(text, voice_key, user_id):
|
|
| 197 |
# --- CHAT DISPLAY
|
| 198 |
display_chat_history()
|
| 199 |
|
| 200 |
-
# --- Bottom input
|
| 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 |
|
| 215 |
# --- JS auto-scroll
|
| 216 |
st.markdown("""
|
|
@@ -222,6 +211,10 @@ window.onload = function() {
|
|
| 222 |
</script>
|
| 223 |
""", unsafe_allow_html=True)
|
| 224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
# --- Handle user input
|
| 226 |
if user_input:
|
| 227 |
thread_id = get_or_create_thread_id()
|
|
|
|
| 57 |
display: block;
|
| 58 |
}
|
| 59 |
.lor-brand-bar {
|
| 60 |
+
width: 100vw;
|
| 61 |
+
text-align: center;
|
| 62 |
+
background: none;
|
| 63 |
+
margin-bottom: 0.5em;
|
| 64 |
+
margin-top: 0.1em;
|
| 65 |
+
position: relative;
|
| 66 |
}
|
| 67 |
+
.clear-chat-btn-top {
|
| 68 |
+
position: absolute;
|
| 69 |
+
top: 5px;
|
| 70 |
+
right: 10px;
|
| 71 |
+
font-size: 1.4em;
|
| 72 |
+
color: #ccc;
|
| 73 |
+
background: none;
|
| 74 |
+
border: none;
|
| 75 |
+
cursor: pointer;
|
| 76 |
+
z-index: 1000;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
.stChatMessage { max-width: 85%; border-radius: 12px; padding: 8px; margin-bottom: 10px; }
|
| 80 |
.stChatMessage[data-testid="stChatMessage-user"] { background: #f0f0f0; color: #000000; }
|
| 81 |
.stChatMessage[data-testid="stChatMessage-assistant"] { background: #e3f2fd; color: #000000; }
|
|
|
|
| 92 |
width: 100%;
|
| 93 |
background: #191b22;
|
| 94 |
padding: 0.5em 0.6em;
|
|
|
|
|
|
|
|
|
|
| 95 |
border-top: 1px solid #22232c;
|
| 96 |
z-index: 999;
|
| 97 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
</style>
|
| 99 |
""", unsafe_allow_html=True)
|
| 100 |
|
| 101 |
+
# --- Branding + clear button at top
|
| 102 |
st.markdown("""
|
| 103 |
<div class="lor-brand-bar">
|
| 104 |
<img src="https://lortechnologies.com/wp-content/uploads/2023/03/LOR-Online-Logo.svg" class="logo-mini" />
|
| 105 |
<div style="font-size: 13px; color: #888;">Powered by LOR Technologies</div>
|
| 106 |
+
<button class="clear-chat-btn-top" onclick="window.location.href='?clear=1'">🗑️</button>
|
| 107 |
</div>
|
| 108 |
""", unsafe_allow_html=True)
|
| 109 |
|
|
|
|
| 195 |
# --- CHAT DISPLAY
|
| 196 |
display_chat_history()
|
| 197 |
|
| 198 |
+
# --- Bottom chat input
|
| 199 |
with st.container():
|
| 200 |
st.markdown('<div class="input-bottom-bar">', unsafe_allow_html=True)
|
|
|
|
|
|
|
| 201 |
user_input = st.chat_input("Type your message here...")
|
| 202 |
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
# --- JS auto-scroll
|
| 205 |
st.markdown("""
|
|
|
|
| 211 |
</script>
|
| 212 |
""", unsafe_allow_html=True)
|
| 213 |
|
| 214 |
+
# --- Handle clear button
|
| 215 |
+
if st.query_params.get("clear") == "1":
|
| 216 |
+
clear_chat_history()
|
| 217 |
+
|
| 218 |
# --- Handle user input
|
| 219 |
if user_input:
|
| 220 |
thread_id = get_or_create_thread_id()
|