Update app.py
Browse files
app.py
CHANGED
@@ -54,6 +54,7 @@ def inject_custom_css():
|
|
54 |
border: 1px solid #e2e8f0;
|
55 |
position: relative;
|
56 |
transition: transform 0.2s ease;
|
|
|
57 |
}
|
58 |
|
59 |
.question-box:hover {
|
@@ -119,12 +120,77 @@ def inject_custom_css():
|
|
119 |
}
|
120 |
|
121 |
.help-chat {
|
122 |
-
background: rgba(255,255,255,0.
|
123 |
-
backdrop-filter: blur(
|
124 |
-
border-radius:
|
125 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
margin: 1rem 0;
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
|
130 |
@keyframes fadeInSlide {
|
@@ -401,19 +467,50 @@ def main():
|
|
401 |
st.experimental_rerun()
|
402 |
|
403 |
# Side Help Option: independent chat with an AI help assistant using Hugging Face model
|
404 |
-
with st.expander("
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
# Guess confirmation screen using text input response
|
418 |
elif st.session_state.game_state == "confirm_guess":
|
419 |
st.markdown(f'''
|
|
|
54 |
border: 1px solid #e2e8f0;
|
55 |
position: relative;
|
56 |
transition: transform 0.2s ease;
|
57 |
+
color: #1E293B; /* Add this line to ensure black text */
|
58 |
}
|
59 |
|
60 |
.question-box:hover {
|
|
|
120 |
}
|
121 |
|
122 |
.help-chat {
|
123 |
+
background: rgba(255,255,255,0.98);
|
124 |
+
backdrop-filter: blur(12px);
|
125 |
+
border-radius: 16px;
|
126 |
+
padding: 1.5rem;
|
127 |
+
margin: 2rem 0;
|
128 |
+
box-shadow: 0 12px 40px rgba(0,0,0,0.15);
|
129 |
+
border: 1px solid #e2e8f0;
|
130 |
+
max-height: 400px;
|
131 |
+
overflow-y: auto;
|
132 |
+
}
|
133 |
+
.chat-header {
|
134 |
+
display: flex;
|
135 |
+
align-items: center;
|
136 |
+
gap: 12px;
|
137 |
+
margin-bottom: 1.5rem;
|
138 |
+
padding-bottom: 1rem;
|
139 |
+
border-bottom: 2px solid #f1f5f9;
|
140 |
+
}
|
141 |
+
|
142 |
+
.chat-header-icon {
|
143 |
+
background: #6C63FF;
|
144 |
+
width: 40px;
|
145 |
+
height: 40px;
|
146 |
+
border-radius: 12px;
|
147 |
+
display: flex;
|
148 |
+
align-items: center;
|
149 |
+
justify-content: center;
|
150 |
+
color: white;
|
151 |
+
font-size: 1.2rem;
|
152 |
+
}
|
153 |
+
|
154 |
+
.chat-message {
|
155 |
margin: 1rem 0;
|
156 |
+
padding: 1rem;
|
157 |
+
border-radius: 12px;
|
158 |
+
max-width: 80%;
|
159 |
+
animation: fadeInSlide 0.3s ease;
|
160 |
+
}
|
161 |
+
|
162 |
+
.user-message {
|
163 |
+
background: #6C63FF;
|
164 |
+
color: white;
|
165 |
+
margin-left: auto;
|
166 |
+
border-bottom-right-radius: 4px;
|
167 |
+
}
|
168 |
+
|
169 |
+
.assistant-message {
|
170 |
+
background: #f8f9fa;
|
171 |
+
color: #1e293b;
|
172 |
+
margin-right: auto;
|
173 |
+
border-bottom-left-radius: 4px;
|
174 |
+
}
|
175 |
+
|
176 |
+
.message-content {
|
177 |
+
font-size: 0.95rem;
|
178 |
+
line-height: 1.5;
|
179 |
+
}
|
180 |
+
|
181 |
+
.message-timestamp {
|
182 |
+
font-size: 0.75rem;
|
183 |
+
color: #64748b;
|
184 |
+
margin-top: 0.5rem;
|
185 |
+
text-align: right;
|
186 |
+
}
|
187 |
+
|
188 |
+
.chat-input {
|
189 |
+
position: sticky;
|
190 |
+
bottom: 0;
|
191 |
+
background: white;
|
192 |
+
padding-top: 1rem;
|
193 |
+
margin-top: 1rem;
|
194 |
}
|
195 |
|
196 |
@keyframes fadeInSlide {
|
|
|
467 |
st.experimental_rerun()
|
468 |
|
469 |
# Side Help Option: independent chat with an AI help assistant using Hugging Face model
|
470 |
+
with st.expander("🧠 AI Assistant Help Center", expanded=False):
|
471 |
+
st.markdown("""
|
472 |
+
<div class="chat-header">
|
473 |
+
<div class="chat-header-icon">
|
474 |
+
<i class="fas fa-robot"></i>
|
475 |
+
</div>
|
476 |
+
<h3 style="margin:0;color:#1e293b;">Gameplay Assistant</h3>
|
477 |
+
</div>
|
478 |
+
""", unsafe_allow_html=True)
|
479 |
+
|
480 |
+
# Chat messages container
|
481 |
+
chat_container = st.container()
|
482 |
+
|
483 |
+
# Input at bottom
|
484 |
+
with st.form("help_chat_form"):
|
485 |
+
cols = st.columns([4, 1])
|
486 |
+
help_query = cols[0].text_input("Type your question here:", key="help_query",
|
487 |
+
placeholder="How to play? What are the rules?")
|
488 |
+
submitted = cols[1].form_submit_button("Send →")
|
489 |
+
|
490 |
+
if submitted and help_query:
|
491 |
+
help_response = ask_help_agent(help_query)
|
492 |
+
st.session_state.help_conversation.append({"query": help_query, "response": help_response})
|
493 |
+
st.experimental_rerun()
|
494 |
+
|
495 |
+
# Display chat messages
|
496 |
+
with chat_container:
|
497 |
+
if st.session_state.help_conversation:
|
498 |
+
for msg in st.session_state.help_conversation:
|
499 |
+
# User message
|
500 |
+
st.markdown(f"""
|
501 |
+
<div class="chat-message user-message">
|
502 |
+
<div class="message-content">{msg['query']}</div>
|
503 |
+
<div class="message-timestamp">You</div>
|
504 |
+
</div>
|
505 |
+
""", unsafe_allow_html=True)
|
506 |
+
|
507 |
+
# Assistant message
|
508 |
+
st.markdown(f"""
|
509 |
+
<div class="chat-message assistant-message">
|
510 |
+
<div class="message-content" style="color:#1e293b;">{msg['response']}</div>
|
511 |
+
<div class="message-timestamp">Assistant</div>
|
512 |
+
</div>
|
513 |
+
""", unsafe_allow_html=True)
|
514 |
# Guess confirmation screen using text input response
|
515 |
elif st.session_state.game_state == "confirm_guess":
|
516 |
st.markdown(f'''
|