enfoquealafamilia commited on
Commit
12fdb99
·
verified ·
1 Parent(s): 943d7fd

F3 branding: colores Focus (blanco default + toggle azul Focus dark) via .streamlit/config.toml, titulo 'Enfoque Proto Chatbot X.Y' con version

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +9 -0
  2. app.py +41 -3
.streamlit/config.toml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Tema Focus (claro por defecto). Solo colores; NO se cambia la tipografia.
2
+ # Fuente de los valores: design/focus-brand-claude-design/tokens/tokens.css
3
+ # El modo oscuro (azul Focus) se activa con el toggle del sidebar (CSS en app.py).
4
+ [theme]
5
+ base = "light"
6
+ primaryColor = "#006585"
7
+ backgroundColor = "#FFFFFF"
8
+ secondaryBackgroundColor = "#F1F1F1"
9
+ textColor = "#11384D"
app.py CHANGED
@@ -13,6 +13,11 @@ BASE_DIR = Path(__file__).parent
13
  KB_NAME = "enfoque-proto-chat-knowledge-base.md"
14
  KB_PATH = BASE_DIR / KB_NAME
15
 
 
 
 
 
 
16
  # --- Persistencia remota (fuente de verdad) --------------------------------
17
  # La KB .md vive en el repo del Space; la bitacora en un dataset aparte. Ambas
18
  # se persisten por commit remoto (HfApi), NO en session_state. Por eso limpiar
@@ -22,7 +27,33 @@ DATA_REPO = "enfoquealafamilia/enfoque-proto-chat-data-kb"
22
  BITACORA_NAME = "bitacora.jsonl"
23
  HF_TOKEN = os.getenv("HF_TOKEN", "")
24
 
25
- st.set_page_config(page_title="enfoque-proto-chat", page_icon="\U0001F4AC", layout="wide")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
 
28
  def _now_str():
@@ -42,7 +73,7 @@ def _check_auth():
42
  return
43
  if st.session_state.get("_authenticated"):
44
  return
45
- st.markdown("### enfoque-proto-chat")
46
  usuario = st.text_input("Usuario")
47
  clave = st.text_input("Contraseña", type="password")
48
  if st.button("Ingresar"):
@@ -908,12 +939,15 @@ if "pending_revert" not in st.session_state:
908
  st.session_state.pending_revert = None
909
  if "rep_name" not in st.session_state:
910
  st.session_state.rep_name = ""
 
 
911
 
912
 
913
  # -- Sidebar -------------------------------------------------------------------
914
 
915
  with st.sidebar:
916
- st.title("enfoque-proto-chat")
 
917
 
918
  model_options = [k for k, v in MODELS.items() if os.getenv(v["env_key"])]
919
 
@@ -971,6 +1005,10 @@ with st.sidebar:
971
  st.caption("Sin cambios registrados todavia.")
972
 
973
 
 
 
 
 
974
  # -- Chat UI -------------------------------------------------------------------
975
 
976
  # Encabezado con boton de limpiar chat. NOTA: limpiar el chat solo resetea el
 
13
  KB_NAME = "enfoque-proto-chat-knowledge-base.md"
14
  KB_PATH = BASE_DIR / KB_NAME
15
 
16
+ # Version del bot. Se INCREMENTA al desplegar una mejora salida del feedback de los reps
17
+ # (se comunica el numero en el changelog de esa release). Formato X.Y.
18
+ APP_VERSION = "1.0"
19
+ APP_TITLE = f"Enfoque Proto Chatbot {APP_VERSION}"
20
+
21
  # --- Persistencia remota (fuente de verdad) --------------------------------
22
  # La KB .md vive en el repo del Space; la bitacora en un dataset aparte. Ambas
23
  # se persisten por commit remoto (HfApi), NO en session_state. Por eso limpiar
 
27
  BITACORA_NAME = "bitacora.jsonl"
28
  HF_TOKEN = os.getenv("HF_TOKEN", "")
29
 
30
+ st.set_page_config(page_title=APP_TITLE, page_icon="\U0001F4AC", layout="wide")
31
+
32
+
33
+ # -- Tema Focus: modo oscuro (azul Focus) opcional via toggle del sidebar ------
34
+ # El modo CLARO (blanco) es el default y lo define .streamlit/config.toml.
35
+ # Fuente de los colores: design/focus-brand-claude-design/tokens/tokens.css
36
+ _DARK_CSS = """
37
+ <style>
38
+ .stApp { background-color: #081C26 !important; }
39
+ [data-testid="stSidebar"] { background-color: #0C2A39 !important; }
40
+ .stApp, .stApp p, .stApp li, .stApp label, .stApp span,
41
+ .stApp h1, .stApp h2, .stApp h3, .stApp h4,
42
+ [data-testid="stSidebar"] * { color: #F1F1F1 !important; }
43
+ .stApp a { color: #A2D4CF !important; }
44
+ [data-testid="stChatMessage"] { background-color: #11384D !important; }
45
+ [data-testid="stChatInput"] textarea,
46
+ .stApp textarea, .stApp input { background-color: #0C2A39 !important; color: #F1F1F1 !important; }
47
+ .stApp blockquote { border-left-color: #4D99A9 !important; }
48
+ [data-testid="stChatInput"] { background-color: #0C2A39 !important; }
49
+ </style>
50
+ """
51
+
52
+
53
+ def apply_focus_theme():
54
+ """Inyecta el CSS del modo oscuro (azul Focus) si el toggle esta activo."""
55
+ if st.session_state.get("dark_mode"):
56
+ st.markdown(_DARK_CSS, unsafe_allow_html=True)
57
 
58
 
59
  def _now_str():
 
73
  return
74
  if st.session_state.get("_authenticated"):
75
  return
76
+ st.markdown(f"### {APP_TITLE}")
77
  usuario = st.text_input("Usuario")
78
  clave = st.text_input("Contraseña", type="password")
79
  if st.button("Ingresar"):
 
939
  st.session_state.pending_revert = None
940
  if "rep_name" not in st.session_state:
941
  st.session_state.rep_name = ""
942
+ if "dark_mode" not in st.session_state:
943
+ st.session_state.dark_mode = False
944
 
945
 
946
  # -- Sidebar -------------------------------------------------------------------
947
 
948
  with st.sidebar:
949
+ st.title(APP_TITLE)
950
+ st.toggle("🌙 Modo oscuro (azul Focus)", key="dark_mode")
951
 
952
  model_options = [k for k, v in MODELS.items() if os.getenv(v["env_key"])]
953
 
 
1005
  st.caption("Sin cambios registrados todavia.")
1006
 
1007
 
1008
+ # Aplica el tema oscuro (azul Focus) si el toggle del sidebar esta activo.
1009
+ apply_focus_theme()
1010
+
1011
+
1012
  # -- Chat UI -------------------------------------------------------------------
1013
 
1014
  # Encabezado con boton de limpiar chat. NOTA: limpiar el chat solo resetea el