gnosticdev commited on
Commit
8e1bdee
verified
1 Parent(s): fa92574

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -47,34 +47,6 @@ def download_chat_history(history):
47
  chat_text += f"{message.role}: {message.parts[0].text}\n"
48
  return chat_text
49
 
50
- # Inicializar estados
51
- if "system_prompt" not in st.session_state:
52
- st.session_state.system_prompt = st.session_state.get('cookie_system_prompt', "")
53
-
54
- if "cookie_urls" not in st.session_state:
55
- st.session_state.cookie_urls = []
56
-
57
- with st.sidebar:
58
- selected = option_menu(
59
- "GD AI",
60
- ["System Prompt", "Chatbot", "Image Captioning"],
61
- menu_icon="robot",
62
- icons=['gear', 'chat-dots-fill', 'image-fill'],
63
- default_index=0
64
- )
65
-
66
- # Bot贸n para borrar historial
67
- if st.button("Borrar Historial"):
68
- if 'cookie_chat_history' in st.session_state:
69
- del st.session_state.cookie_chat_history
70
- if 'chat_session' in st.session_state:
71
- del st.session_state.chat_session
72
- st.success("Historial borrado!")
73
-
74
- def translate_role_to_streamlit(user_role):
75
- return "assistant" if user_role == "model" else user_role
76
-
77
- # Aqu铆 comienza la l贸gica de la aplicaci贸n
78
  if selected == "System Prompt":
79
  st.title("Configuraci贸n del System Prompt")
80
 
@@ -93,7 +65,7 @@ if selected == "System Prompt":
93
  help="Escribe aqu铆 las URLs que el AI puede usar como referencia, separadas por comas."
94
  )
95
 
96
- if st.button("Guardar System Prompt y URLs"):
97
  st.session_state.system_prompt = new_system_prompt
98
  st.session_state.cookie_system_prompt = new_system_prompt
99
  st.session_state.cookie_urls = [url.strip() for url in urls_input.split(",") if url.strip()] # Guardar las URLs en una lista
@@ -180,4 +152,3 @@ elif selected == "Image Captioning":
180
  st.info(caption)
181
 
182
  # Fin del script
183
-
 
47
  chat_text += f"{message.role}: {message.parts[0].text}\n"
48
  return chat_text
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  if selected == "System Prompt":
51
  st.title("Configuraci贸n del System Prompt")
52
 
 
65
  help="Escribe aqu铆 las URLs que el AI puede usar como referencia, separadas por comas."
66
  )
67
 
68
+ if st.button("Guardar System Prompt y URLs"):
69
  st.session_state.system_prompt = new_system_prompt
70
  st.session_state.cookie_system_prompt = new_system_prompt
71
  st.session_state.cookie_urls = [url.strip() for url in urls_input.split(",") if url.strip()] # Guardar las URLs en una lista
 
152
  st.info(caption)
153
 
154
  # Fin del script