Update app.py
Browse files5 unmodified lines6789101112131415161740 unmodified lines58596061626364656667686970717273747576777879808182835 unmodified lines# ===================== HELPERS =====================def normalize_text(s: str) -> str:"""Evita bugs de formatação (acentos/itálico/negrito) no Markdown do Streamlit."""if s is None:return ""s = s.replace("_", "\\_")s = s.replace("*", "\\*")s = unicodedata.normalize("NFC", s)return s# ===================== API KEY (fallback) =====================40 unmodified linesst.markdown("""<style>.main .block-container {display: flex;flex-direction: column;justify-content: center;align-items: center;min-height: 85vh;text-align: center;}[data-testid="stChatInput"] {width: 72%;margin: 0 auto;}.intro-text { font-size: 1.2rem; color: #ddd; margin-bottom: 2rem; line-height: 1.5; }.title { font-size: 1.8rem; font-weight: 600; color: #fff; margin-bottom: 0.5rem; }.disclaimer { opacity: .9; margin-top: 1.25rem; }</style>""",unsafe_allow_html=True,)# ===================== HEADER =====================st.markdown("""5 unmodified lines67891011121314151617181920212240 unmodified lines6364656667686970717273747576777879808182838485868788899091929394959697985 unmodified lines# ===================== HELPERS =====================def normalize_text(s: str) -> str:"""Evita bugs de formatação no Markdown do Streamlit."""if s is None:return ""# Normaliza primeiros = unicodedata.normalize("NFC", s)# Escapes de Markdown/MathJaxs = s.replace("\\", "\\\\") # barra invertida primeiros = s.replace("_", "\\_")s = s.replace("*", "\\*")s = s.replace("$", "\\$") # <<<<<< ESCAPE DO CIFRÃO (resolve o seu bug)s = s.replace("|", "\\|")return s# ===================== API KEY (fallback) =====================40 unmodified linesst.markdown("""<style>.main .block-container {display: flex;flex-direction: column;justify-content: center;align-items: center;min-height: 85vh;text-align: center;}[data-testid="stChatInput"] {width: 72%;margin: 0 auto;}.intro-text { font-size: 1.2rem; color: #ddd; margin-bottom: 2rem; line-height: 1.5; }.title { font-size: 1.8rem; font-weight: 600; color: #fff; margin-bottom: 0.5rem; }.disclaimer { opacity: .9; margin-top: 1.25rem; }</style>""",unsafe_allow_html=True)# 🔽 Adicione este segundo bloco logo abaixo 🔽st.markdown("""<style>/* chat sempre alinhado à esquerda */.stChatMessage, .stChatMessage p, .stChatMessage li, .stChatMessage ul, .stChatMessage ol {text-align: left !important;}</style>""", unsafe_allow_html=True)# ===================== HEADER =====================st.markdown("""
app.py+33-18