aldohenrique commited on
Commit
24799c3
verified
1 Parent(s): 5a42c65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -138,7 +138,7 @@ def formatar_resposta_com_codigo(resposta: str) -> str:
138
  # Detecta blocos de c贸digo com ```
139
  resposta_formatada = re.sub(
140
  r'```(\w+)?\n(.*?)\n```',
141
- r'<div style="background-color: #f8f9fa;color: #1a1a1a !important; border: 1px solid #e9ecef; border-radius: 8px; padding: 15px; margin: 10px 0; font-family: Monaco, Consolas, monospace; overflow-x: auto;"><strong style="color: black !important;">馃捇 C贸digo:</strong><br><pre style="color: black !important; margin: 5px 0; white-space: pre-wrap; word-wrap: break-word;"><code>\2</code></pre></div>',
142
  resposta,
143
  flags=re.DOTALL
144
  )
@@ -146,7 +146,7 @@ def formatar_resposta_com_codigo(resposta: str) -> str:
146
  # Detecta c贸digo inline com `
147
  resposta_formatada = re.sub(
148
  r'`([^`]+)`',
149
- r'<code style="background-color: #f1f3f4; color: #1a1a1a !important; padding: 2px 4px; border-radius: 4px; font-family: Monaco, Consolas, monospace;">\1</code>',
150
  resposta_formatada
151
  )
152
 
@@ -157,7 +157,7 @@ def formatar_resposta_com_codigo(resposta: str) -> str:
157
  # Destaca t铆tulos/se莽玫es
158
  resposta_formatada = re.sub(
159
  r'^\*\*(.*?)\*\*',
160
- r'<h3 style="color: #1976d2; color: #1a1a1a !important; margin-top: 20px; margin-bottom: 10px;">\1</h3>',
161
  resposta_formatada,
162
  flags=re.MULTILINE
163
  )
@@ -248,8 +248,8 @@ css_customizado = """
248
  }
249
 
250
  .resposta-container {
251
- background-color: #ffffff !important;
252
- color: #1a1a1a !important;
253
  border: 1px solid #e0e0e0 !important;
254
  border-radius: 20px !important;
255
  padding: 20px !important;
@@ -258,7 +258,8 @@ css_customizado = """
258
  }
259
 
260
  .resposta-container pre code {
261
- color: #1a1a1a !important;
 
262
  }
263
 
264
  .pergunta-container {
@@ -275,14 +276,6 @@ css_customizado = """
275
  margin-bottom: 20px !important;
276
  text-align: center !important;
277
  }
278
-
279
- @media (prefers-color-scheme: dark) {
280
- .resposta-container {
281
- background-color: #2d2d2d !important;
282
- color: #e0e0e0 !important;
283
- border-color: #444 !important;
284
- }
285
- }
286
  """
287
 
288
  # Interface Gradio
 
138
  # Detecta blocos de c贸digo com ```
139
  resposta_formatada = re.sub(
140
  r'```(\w+)?\n(.*?)\n```',
141
+ r'<div style="background-color: #f8f9fa; color: #1a1a1a; border: 1px solid #e9ecef; border-radius: 8px; padding: 15px; margin: 10px 0; font-family: Monaco, Consolas, monospace; overflow-x: auto;"><strong style="color: #1a1a1a;">馃捇 C贸digo:</strong><br><pre style="color: #1a1a1a; margin: 5px 0; white-space: pre-wrap; word-wrap: break-word;"><code>\2</code></pre></div>',
142
  resposta,
143
  flags=re.DOTALL
144
  )
 
146
  # Detecta c贸digo inline com `
147
  resposta_formatada = re.sub(
148
  r'`([^`]+)`',
149
+ r'<code style="background-color: #f1f3f4; color: #1a1a1a; padding: 2px 4px; border-radius: 4px; font-family: Monaco, Consolas, monospace;">\1</code>',
150
  resposta_formatada
151
  )
152
 
 
157
  # Destaca t铆tulos/se莽玫es
158
  resposta_formatada = re.sub(
159
  r'^\*\*(.*?)\*\*',
160
+ r'<h3 style="color: #1a1a1a; margin-top: 20px; margin-bottom: 10px;">\1</h3>',
161
  resposta_formatada,
162
  flags=re.MULTILINE
163
  )
 
248
  }
249
 
250
  .resposta-container {
251
+ background-color: #ffffff !important; /* Always light background */
252
+ color: #1a1a1a !important; /* Always dark text */
253
  border: 1px solid #e0e0e0 !important;
254
  border-radius: 20px !important;
255
  padding: 20px !important;
 
258
  }
259
 
260
  .resposta-container pre code {
261
+ color: #1a1a1a !important; /* Ensure code text is dark */
262
+ background-color: #f8f9fa !important; /* Light background for code */
263
  }
264
 
265
  .pergunta-container {
 
276
  margin-bottom: 20px !important;
277
  text-align: center !important;
278
  }
 
 
 
 
 
 
 
 
279
  """
280
 
281
  # Interface Gradio