jdesiree commited on
Commit
2821d69
·
verified ·
1 Parent(s): 16f2773

Update Gradio Container

Browse files

Following an update to Gradio, the container needed to be changed.

Changed .gradio-container-5-42-0 to .gradio-container and [class*="gradio-container"] to catch any versioned container class.

Files changed (1) hide show
  1. app.py +50 -384
app.py CHANGED
@@ -1,229 +1,3 @@
1
- import gradio as gr
2
- from langchain.prompts import ChatPromptTemplate
3
- from langchain.schema import HumanMessage, SystemMessage, AIMessage
4
- from huggingface_hub import InferenceClient
5
- from metrics import EduBotMetrics
6
- import os
7
- import time
8
- import logging
9
- import re
10
-
11
- # --- Environment and Logging Setup ---
12
- logging.basicConfig(level=logging.INFO)
13
- logger = logging.getLogger(__name__)
14
-
15
- # Support both token names for flexibility
16
- hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACEHUB_API_TOKEN")
17
- if not hf_token:
18
- logger.warning("Neither HF_TOKEN nor HUGGINGFACEHUB_API_TOKEN is set, the application may not work.")
19
-
20
- # --- LLM Configuration ---
21
- client = InferenceClient(
22
- provider="together",
23
- api_key=hf_token,
24
- )
25
-
26
- metrics_tracker = EduBotMetrics(save_file="edu_metrics.json")
27
-
28
- # --- LLM Templates ---
29
- # Enhanced base system message
30
- SYSTEM_MESSAGE = """You are EduBot, an expert multi-concept tutor designed to facilitate genuine learning and understanding. Your primary mission is to guide students through the learning process rather than providing direct answers to academic work.
31
-
32
- ## Core Educational Principles
33
- - Provide comprehensive, educational responses that help students truly understand concepts
34
- - Use minimal formatting, with markdown bolding reserved for **key terms** only
35
- - Prioritize teaching methodology over answer delivery
36
- - Foster critical thinking and independent problem-solving skills
37
-
38
- ## Tone and Communication Style
39
- - Maintain an engaging, friendly tone appropriate for high school students
40
- - Write at a reading level that is accessible yet intellectually stimulating
41
- - Be supportive and encouraging without being condescending
42
- - Never use crude language or content inappropriate for an educational setting
43
- - Avoid preachy, judgmental, or accusatory language
44
- - Skip flattery and respond directly to questions
45
- - Do not use emojis or actions in asterisks unless specifically requested
46
- - Present critiques and corrections kindly as educational opportunities
47
-
48
- ## Academic Integrity Approach
49
- You recognize that students may seek direct answers to homework, assignments, or test questions. Rather than providing complete solutions or making accusations about intent, you should:
50
-
51
- - **Guide through processes**: Break down problems into conceptual components and teach underlying principles
52
- - **Ask clarifying questions**: Understand what the student already knows and where their confusion lies
53
- - **Provide similar examples**: Work through analogous problems that demonstrate the same concepts without directly solving their specific assignment
54
- - **Encourage original thinking**: Help students develop their own reasoning and analytical skills
55
- - **Suggest study strategies**: Recommend effective learning approaches for the subject matter
56
-
57
- ## Response Guidelines
58
- - **For math problems**: Explain concepts, provide formula derivations, and guide through problem-solving steps without computing final numerical answers
59
- - **For multiple-choice questions**: Discuss the concepts being tested and help students understand how to analyze options rather than identifying the correct choice
60
- - **For essays or written work**: Discuss research strategies, organizational techniques, and critical thinking approaches rather than providing content or thesis statements
61
- - **For factual questions**: Provide educational context and encourage students to synthesize information rather than stating direct answers
62
-
63
- ## Handling Limitations
64
- **Web Search Requests**: You do not have access to the internet and cannot perform web searches. When asked to search the web, respond honestly about this limitation and offer alternative assistance:
65
- - "I'm unable to perform web searches, but I can help you plan a research strategy for this topic"
66
- - "I can't browse the internet, but I'd be happy to teach you effective Google search syntax to find what you need"
67
- - "While I can't search online, I can help you evaluate whether sources you find are reliable and appropriate for your research"
68
-
69
- **Other Limitations**: When encountering other technical limitations, acknowledge them directly and offer constructive alternatives that support learning.
70
-
71
- ## Communication Guidelines
72
- - Maintain a supportive, non-judgmental tone in all interactions
73
- - Assume positive intent while redirecting toward genuine learning
74
- - Use Socratic questioning to promote discovery and critical thinking
75
- - Celebrate understanding and progress in the learning process
76
- - Encourage students to explain their thinking and reasoning
77
- - Provide honest, accurate feedback even when it may not be what the student wants to hear
78
-
79
- ## Modes
80
- **Select the mode that best matches the user's needs.**
81
-
82
- **Math Mode**
83
- LaTeX formatting is enabled for math. You must provide LaTeX formatting for all math, either as inline LaTeX or centered display LaTeX.
84
- You will address requests to solve, aid in understanding, or explore mathematical context. Use logical ordering for content, providing necessary terms and definitions as well as concept explanations along with math to foster understanding of core concepts. Rather than specifically answering the math problem provided, begin with solving a similar problem that requires the same steps and foundational mathematical knowledge, then prompt the user to work through the problem themselves. If the user insists you solve the problem, engage in a two-way conversation where you provide the steps but request the user solve for the answer one step at a time.
85
- LaTeX should always be used for math.
86
- LaTeX Examples:
87
- - Inline: "The slope is $m = \\frac{{y_2 - y_1}}{{x_2 - x_1}}$ in this case."
88
- - Display: "The quadratic formula is: $x = \\frac{{-b \\pm \\sqrt{{b^2-4ac}}}}{{2a}}$"
89
- Always use double backslashes (\\\\) for LaTeX commands like \\\\frac, \\\\sqrt, \\\\int, etc.
90
-
91
- **Research Mode**
92
- Your main goal is to help the user learn to research topics, a critical skill. Function as a partner rather than a search engine.
93
- Over the course of the conversation, guide the user through a seven-step research process:
94
- 1) **Identifying a topic**
95
- 2) **Finding background information**
96
- 3) **Developing a research design**
97
- 4) **Collecting data**
98
- 5) **Analyzing data**
99
- 6) **Drawing conclusions**
100
- 7) **Disseminating findings**
101
- You may provide formatted citations if the user asks for them and provides the needed information. If not all information is provided but citations are requested, follow up with guidance on how to obtain the information to generate a citation. By default, you will not provide citations.
102
- Example citations:
103
- APA Style
104
- In-text: (Smith, 2023, p. 45)
105
- Reference: Smith, J. A. (2023). Book title. Publisher.
106
- MLA Style
107
- In-text: (Smith 45)
108
- Works Cited: Smith, John A. Book Title. Publisher, 2023.
109
- Chicago Style
110
- Footnote: ¹John A. Smith, Book Title (Publisher, 2023), 45.
111
- Bibliography: Smith, John A. Book Title. Publisher, 2023.
112
- Harvard Style
113
- In-text: (Smith 2023, p. 45)
114
- Reference: Smith, J.A. (2023) Book title. Publisher.
115
- IEEE Style
116
- In-text: [1]
117
- Reference: [1] J. A. Smith, Book Title. Publisher, 2023.
118
- In this mode you may not use LaTeX formatting.
119
-
120
- **Study Mode**
121
- Engage the user in a mix of two teaching styles: student-centered and inquiry-based learning.
122
- Student Centered: Adjust to reflect the student's reading level and level of understanding of a topic as the conversation progresses. Do not assume the user is an expert but instead assume they may have familiarity but desire to learn more about the topic they are studying. Provide definitions for terms you use in a conversational way, gradually shifting to using just the terms without definitions as the user becomes more familiar with them.
123
- Inquiry-based learning: Engage the user through questions that compel them to consider what they want to know and then explore the topics through guided conversation.
124
- Over the course of the conversation, prompt the user with a question to gauge their growing knowledge or progress on the topic.
125
- For example:
126
- After two to three turns of conversation discussing a topic, pick a specific term or concept from the conversation history to craft either a multiple-choice or written answer question for the user with no other comments along with it. If the student is correct, congratulate them on their progress and inquire about their next learning goal on the topic. If the user fails the question, return with a short response that explains the correct answer in a kind tone.
127
- In this mode you may not use LaTeX formatting.
128
-
129
- **General/Other Mode**
130
- You are EduBot, a comprehensive AI learning assistant. Help users leverage educational tools and resources to enrich their education. Offer yourself as a resource for the student, prompting them to request help with **math topics**, **research strategy**, or **studying a topic**.
131
-
132
- Your goal is to be an educational partner who empowers students to succeed through understanding, not a service that completes their work for them."""
133
-
134
- # --- Core Logic Functions ---
135
-
136
- def smart_truncate(text, max_length=3000):
137
- """Truncates text intelligently to the last full sentence or word."""
138
- if len(text) <= max_length:
139
- return text
140
-
141
- # Try to split by sentence
142
- sentences = re.split(r'(?<=[.!?])\s+', text[:max_length])
143
- if len(sentences) > 1:
144
- return ' '.join(sentences[:-1]) + "... [Response truncated - ask for continuation]"
145
- # Otherwise, split by word
146
- else:
147
- words = text[:max_length].split()
148
- return ' '.join(words[:-1]) + "... [Response truncated - ask for continuation]"
149
-
150
- def respond_with_enhanced_streaming(message, history):
151
- """Streams the bot's response, handling errors with metrics tracking."""
152
-
153
- # Start metrics timing
154
- timing_context = metrics_tracker.start_timing()
155
- error_occurred = False
156
- error_message = None
157
- response = ""
158
-
159
- try:
160
- # Build conversation history (last 5 exchanges)
161
- api_messages = [{"role": "system", "content": SYSTEM_MESSAGE}]
162
- if history:
163
- for exchange in history[-5:]:
164
- if exchange.get("role") == "user":
165
- api_messages.append({"role": "user", "content": exchange["content"]})
166
- elif exchange.get("role") == "assistant":
167
- api_messages.append({"role": "assistant", "content": exchange["content"]})
168
-
169
- # Add current user message
170
- api_messages.append({"role": "user", "content": message})
171
-
172
- # Mark provider API start
173
- metrics_tracker.mark_provider_start(timing_context)
174
-
175
- completion = client.chat.completions.create(
176
- model="Qwen/Qwen2.5-7B-Instruct",
177
- messages=api_messages,
178
- max_tokens=4096,
179
- temperature=0.7,
180
- top_p=0.9,
181
- )
182
-
183
- # Mark provider API end
184
- metrics_tracker.mark_provider_end(timing_context)
185
-
186
- response = smart_truncate(completion.choices[0].message.content, max_length=3000)
187
-
188
- # Stream fake-chunks word by word
189
- words = response.split()
190
- partial_response = ""
191
-
192
- for i, word in enumerate(words):
193
- partial_response += word + " "
194
- if i % 4 == 0:
195
- metrics_tracker.record_chunk(timing_context)
196
- yield partial_response
197
- time.sleep(0.03)
198
-
199
- logger.info(f"Response completed. Length: {len(response)} characters")
200
-
201
- metrics_tracker.record_chunk(timing_context)
202
- yield response
203
-
204
- except Exception as e:
205
- error_occurred = True
206
- error_message = str(e)
207
- logger.exception("Error in response generation")
208
- yield "Sorry, I encountered an error while generating the response."
209
-
210
- finally:
211
- metrics_tracker.log_interaction(
212
- query=message,
213
- response=response,
214
- timing_context=timing_context,
215
- error_occurred=error_occurred,
216
- error_message=error_message,
217
- )
218
-
219
-
220
-
221
- # ===============================================================================
222
- # UI CONFIGURATION SECTION - ALL UI RELATED CODE CENTRALIZED HERE
223
- # ===============================================================================
224
-
225
- # --- UI: Custom CSS Styles ---
226
- custom_css = """
227
  /* Import Oswald font - Google Fonts */
228
  @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
229
 
@@ -260,7 +34,7 @@ custom_css = """
260
  display: none !important;
261
  }
262
 
263
- /* Apply Oswald globally */
264
  *, *::before, *::after {
265
  font-family: "Oswald", sans-serif !important;
266
  color: #120f0e !important;
@@ -296,8 +70,8 @@ custom_css = """
296
  width: 100% !important;
297
  }
298
 
299
- /* Main container styling - viewport height with no top margin */
300
- .gradio-container-5-42-0 {
301
  background-color: rgb(240, 236, 230) !important;
302
  font-family: "Oswald", sans-serif !important;
303
  color: #120f0e !important;
@@ -310,8 +84,23 @@ custom_css = """
310
  flex-direction: column !important;
311
  }
312
 
313
- /* Target Gradio's internal structure */
314
- .gradio-container-5-42-0 > div {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  height: 95% !important;
316
  display: flex !important;
317
  flex-direction: column !important;
@@ -319,20 +108,24 @@ custom_css = """
319
  margin-top: 0 !important;
320
  }
321
 
322
- /* Chat styling - FLEX to fill space */
323
- .gradio-container-5-42-0 .gradio-chatbot {
 
324
  background-color: #d9d1ce !important;
325
  border: 1pt solid #59524f !important;
326
  border-radius: 6px !important;
327
  padding: 15px !important;
328
- flex: 1 !important; /* Fill all remaining space */
329
- min-height: 0 !important; /* Prevent overflow issues */
330
  overflow-y: auto !important;
331
  margin: 15px 20px !important;
332
  }
333
 
334
- /* Message styling */
335
- .gradio-container-5-42-0 .gradio-chatbot .message.bot .markdown {
 
 
 
336
  background-color: #f09c7d !important;
337
  color: #120f0e !important;
338
  border-radius: 8px !important;
@@ -346,7 +139,8 @@ custom_css = """
346
  margin-bottom: 10px !important;
347
  }
348
 
349
- .gradio-container-5-42-0 .gradio-chatbot .message.user .markdown {
 
350
  background-color: #a69189 !important;
351
  color: #120f0e !important;
352
  border-radius: 8px !important;
@@ -361,13 +155,6 @@ custom_css = """
361
  }
362
 
363
  /* Input controls styling */
364
- .input-controls {
365
- padding: 15px 20px !important;
366
- background-color: rgb(240, 236, 230) !important;
367
- border-top: 1pt solid #59524f;
368
- flex-shrink: 0 !important;
369
- }
370
-
371
  .input-textbox textarea {
372
  background-color: #f0ece6 !important;
373
  border: 1pt solid #59524f !important;
@@ -417,6 +204,18 @@ custom_css = """
417
  border-color: #4a3f3c !important;
418
  }
419
 
 
 
 
 
 
 
 
 
 
 
 
 
420
  /* Ensure Gradio footer is visible and properly positioned */
421
  footer.svelte-czcr5b {
422
  display: flex !important;
@@ -454,148 +253,15 @@ footer.svelte-czcr5b .divider {
454
 
455
  /* Responsive design */
456
  @media (max-width: 768px) {
457
- .gradio-container-5-42-0 .gradio-chatbot .message.bot .markdown,
458
- .gradio-container-5-42-0 .gradio-chatbot .message.user .markdown {
 
 
 
459
  max-width: 85%;
460
  }
461
 
462
  .input-controls {
463
  padding: 10px !important;
464
  }
465
- }
466
- """
467
-
468
- # --- UI: HTML Head Content ---
469
- html_head_content = '''
470
- <link rel="preconnect" href="https://fonts.googleapis.com">
471
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
472
- <link href="https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap" rel="stylesheet">
473
- <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
474
- <script>
475
- // Force light theme in Gradio
476
- window.addEventListener('DOMContentLoaded', function () {
477
- const gradioURL = window.location.href;
478
- const url = new URL(gradioURL);
479
- const currentTheme = url.searchParams.get('__theme');
480
-
481
- if (currentTheme !== 'light') {
482
- url.searchParams.set('__theme', 'light');
483
- window.location.replace(url.toString());
484
- }
485
- });
486
- </script>
487
- '''
488
-
489
- # --- UI: MathJax Configuration ---
490
- mathjax_config = '''
491
- <script>
492
- window.MathJax = {
493
- tex: {
494
- inlineMath: [['$', '$'], ['\\\\(', '\\\\)']],
495
- displayMath: [['$$', '$$'], ['\\\\[', '\\\\]']],
496
- packages: {'[+]': ['ams']}
497
- },
498
- svg: {fontCache: 'global'},
499
- startup: {
500
- ready: () => {
501
- MathJax.startup.defaultReady();
502
- // Re-render math when new content is added
503
- const observer = new MutationObserver(function(mutations) {
504
- MathJax.typesetPromise();
505
- });
506
- observer.observe(document.body, {childList: true, subtree: true});
507
- }
508
- }
509
- };
510
- </script>
511
- '''
512
-
513
- # --- UI: Event Handlers ---
514
- def respond_and_update(message, history):
515
- """Main function to handle user submission."""
516
- if not message.strip():
517
- return history, ""
518
-
519
- # Add user message to history
520
- history.append({"role": "user", "content": message})
521
- # Yield history to show the user message immediately, and clear the textbox
522
- yield history, ""
523
-
524
- # Stream the bot's response
525
- full_response = ""
526
- for response_chunk in respond_with_enhanced_streaming(message, history):
527
- full_response = response_chunk
528
- # Update the last message (bot's response)
529
- if len(history) > 0 and history[-1]["role"] == "user":
530
- history.append({"role": "assistant", "content": full_response})
531
- else:
532
- history[-1] = {"role": "assistant", "content": full_response}
533
- yield history, ""
534
-
535
- def clear_chat():
536
- """Clear the chat history."""
537
- return [], ""
538
-
539
- # --- UI: Interface Creation ---
540
- def create_interface():
541
- """Creates and configures the complete Gradio interface."""
542
-
543
- with gr.Blocks(
544
- title="EduBot",
545
- fill_width=True,
546
- fill_height=True,
547
- theme=gr.themes.Base()
548
- ) as demo:
549
- # Add head content and MathJax
550
- gr.HTML(html_head_content)
551
- gr.HTML('<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>')
552
- gr.HTML(mathjax_config)
553
-
554
- with gr.Column(elem_classes=["main-container"]):
555
- # Title Section
556
- gr.HTML('<div class="title-header"><h1>🎓 EduBot</h1></div>')
557
-
558
- # Chat Section
559
- with gr.Row():
560
- chatbot = gr.Chatbot(
561
- type="messages",
562
- show_copy_button=True,
563
- show_share_button=False,
564
- avatar_images=None,
565
- elem_id="main-chatbot",
566
- container=False, # Remove wrapper
567
- scale=1,
568
- height="70vh" # Explicit height instead of min_height
569
- )
570
-
571
- # Input Section - fixed height
572
- with gr.Row(elem_classes=["input-controls"]):
573
- msg = gr.Textbox(
574
- placeholder="Ask me about math, research, study strategies, or any educational topic...",
575
- show_label=False,
576
- lines=4,
577
- max_lines=6,
578
- elem_classes=["input-textbox"],
579
- container=False,
580
- scale=4
581
- )
582
- with gr.Column(elem_classes=["button-column"], scale=1):
583
- send = gr.Button("Send", elem_classes=["send-button"], size="sm")
584
- clear = gr.Button("Clear", elem_classes=["clear-button"], size="sm")
585
-
586
- # Set up event handlers
587
- msg.submit(respond_and_update, [msg, chatbot], [chatbot, msg])
588
- send.click(respond_and_update, [msg, chatbot], [chatbot, msg])
589
- clear.click(clear_chat, outputs=[chatbot, msg])
590
-
591
- return demo
592
-
593
- # ===============================================================================
594
- # END UI CONFIGURATION SECTION
595
- # ===============================================================================
596
-
597
- if __name__ == "__main__":
598
- logger.info("Starting EduBot...")
599
- demo = create_interface()
600
- demo.launch(debug=True, share=True)
601
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /* Import Oswald font - Google Fonts */
2
  @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap');
3
 
 
34
  display: none !important;
35
  }
36
 
37
+ /* Apply Oswald globally - Use universal selector instead of version-specific */
38
  *, *::before, *::after {
39
  font-family: "Oswald", sans-serif !important;
40
  color: #120f0e !important;
 
70
  width: 100% !important;
71
  }
72
 
73
+ /* Main container styling - Use universal Gradio container selector */
74
+ .gradio-container {
75
  background-color: rgb(240, 236, 230) !important;
76
  font-family: "Oswald", sans-serif !important;
77
  color: #120f0e !important;
 
84
  flex-direction: column !important;
85
  }
86
 
87
+ /* Also target any versioned container that might exist */
88
+ [class*="gradio-container"] {
89
+ background-color: rgb(240, 236, 230) !important;
90
+ font-family: "Oswald", sans-serif !important;
91
+ color: #120f0e !important;
92
+ padding: 0 !important;
93
+ margin: 0 !important;
94
+ height: 100vh !important;
95
+ max-height: 100vh !important;
96
+ overflow: hidden !important;
97
+ display: flex !important;
98
+ flex-direction: column !important;
99
+ }
100
+
101
+ /* Target Gradio's internal structure - more universal approach */
102
+ .gradio-container > div,
103
+ [class*="gradio-container"] > div {
104
  height: 95% !important;
105
  display: flex !important;
106
  flex-direction: column !important;
 
108
  margin-top: 0 !important;
109
  }
110
 
111
+ /* Chat styling - Use more universal selectors */
112
+ .gradio-chatbot,
113
+ [class*="chatbot"] {
114
  background-color: #d9d1ce !important;
115
  border: 1pt solid #59524f !important;
116
  border-radius: 6px !important;
117
  padding: 15px !important;
118
+ flex: 1 !important;
119
+ min-height: 0 !important;
120
  overflow-y: auto !important;
121
  margin: 15px 20px !important;
122
  }
123
 
124
+ /* Message styling - More universal approach */
125
+ .message.bot .markdown,
126
+ [class*="message"][class*="bot"] .markdown,
127
+ .message.assistant .markdown,
128
+ [class*="message"][class*="assistant"] .markdown {
129
  background-color: #f09c7d !important;
130
  color: #120f0e !important;
131
  border-radius: 8px !important;
 
139
  margin-bottom: 10px !important;
140
  }
141
 
142
+ .message.user .markdown,
143
+ [class*="message"][class*="user"] .markdown {
144
  background-color: #a69189 !important;
145
  color: #120f0e !important;
146
  border-radius: 8px !important;
 
155
  }
156
 
157
  /* Input controls styling */
 
 
 
 
 
 
 
158
  .input-textbox textarea {
159
  background-color: #f0ece6 !important;
160
  border: 1pt solid #59524f !important;
 
204
  border-color: #4a3f3c !important;
205
  }
206
 
207
+ /* Add fallback body styling */
208
+ body {
209
+ background-color: rgb(240, 236, 230) !important;
210
+ font-family: "Oswald", sans-serif !important;
211
+ color: #120f0e !important;
212
+ }
213
+
214
+ /* Target the main app wrapper */
215
+ #root, .app, .main {
216
+ background-color: rgb(240, 236, 230) !important;
217
+ }
218
+
219
  /* Ensure Gradio footer is visible and properly positioned */
220
  footer.svelte-czcr5b {
221
  display: flex !important;
 
253
 
254
  /* Responsive design */
255
  @media (max-width: 768px) {
256
+ .message.bot .markdown,
257
+ .message.user .markdown,
258
+ [class*="message"][class*="bot"] .markdown,
259
+ [class*="message"][class*="user"] .markdown,
260
+ [class*="message"][class*="assistant"] .markdown {
261
  max-width: 85%;
262
  }
263
 
264
  .input-controls {
265
  padding: 10px !important;
266
  }
267
+ }