Spaces:
Sleeping
Sleeping
fix(agent): Ahora utilizamos OpenRouter.
Browse files- Pipfile +1 -2
- src/app.py +13 -17
- src/incident_crew.py +1 -1
Pipfile
CHANGED
|
@@ -5,8 +5,7 @@ name = "pypi"
|
|
| 5 |
|
| 6 |
[packages]
|
| 7 |
streamlit = "~=1.50.0"
|
| 8 |
-
|
| 9 |
-
crewai = {extras = ["tools", "google-genai"], version = "*"}
|
| 10 |
|
| 11 |
[dev-packages]
|
| 12 |
|
|
|
|
| 5 |
|
| 6 |
[packages]
|
| 7 |
streamlit = "~=1.50.0"
|
| 8 |
+
crewai = {extras = ["tools"], version = "*"}
|
|
|
|
| 9 |
|
| 10 |
[dev-packages]
|
| 11 |
|
src/app.py
CHANGED
|
@@ -11,31 +11,30 @@ st.set_page_config(
|
|
| 11 |
)
|
| 12 |
|
| 13 |
# Inicializar el estado de la sesión para la API Key si no existe
|
| 14 |
-
if '
|
| 15 |
-
st.session_state['
|
| 16 |
|
| 17 |
if 'ipinfo_api_key' not in st.session_state:
|
| 18 |
st.session_state['ipinfo_api_key'] = os.getenv("IPINFO_API_KEY", "")
|
| 19 |
|
| 20 |
-
|
| 21 |
-
st.title("📄 Generador IA de Informes Post-Mortem")
|
| 22 |
-
|
| 23 |
# --- Sidebar para la configuración de la API Key ---
|
| 24 |
with st.sidebar:
|
| 25 |
-
st.
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Campo de entrada para la API Key
|
| 28 |
-
if not os.getenv("
|
| 29 |
-
st.session_state['
|
| 30 |
-
"- 🔑 Ingresa tu API Key
|
| 31 |
type="password",
|
| 32 |
-
value=st.session_state['
|
| 33 |
)
|
| 34 |
|
| 35 |
-
if st.session_state['
|
| 36 |
-
st.success("
|
| 37 |
else:
|
| 38 |
-
st.warning("🚨 Por favor, ingresa tu API Key
|
| 39 |
|
| 40 |
if not os.getenv("IPINFO_API_KEY"):
|
| 41 |
st.session_state['ipinfo_api_key'] = st.text_input(
|
|
@@ -49,9 +48,6 @@ with st.sidebar:
|
|
| 49 |
else:
|
| 50 |
st.warning("🚨 Por favor, ingresa tu API Key de IPInfo.")
|
| 51 |
|
| 52 |
-
st.write("- 📄 Completa el formulario con los detalles de la incidencia")
|
| 53 |
-
st.write("- 🚀 Presiona el botón y la IA generará un informe técnico estructurado post-mortem de tu incidente.")
|
| 54 |
-
|
| 55 |
|
| 56 |
# --- Formulario de entrada de datos principal ---
|
| 57 |
with st.form("post_mortem_form"):
|
|
@@ -107,7 +103,7 @@ if submitted:
|
|
| 107 |
|
| 108 |
with st.spinner("⏳ Generando informe técnico..."):
|
| 109 |
crew_response = IncidentReporterCrew(
|
| 110 |
-
api_key=st.session_state['
|
| 111 |
).crew().kickoff(inputs=inputs)
|
| 112 |
|
| 113 |
lineas = crew_response.raw.splitlines()
|
|
|
|
| 11 |
)
|
| 12 |
|
| 13 |
# Inicializar el estado de la sesión para la API Key si no existe
|
| 14 |
+
if 'llm_api_key' not in st.session_state:
|
| 15 |
+
st.session_state['llm_api_key'] = os.getenv("OPENAI_API_KEY", "")
|
| 16 |
|
| 17 |
if 'ipinfo_api_key' not in st.session_state:
|
| 18 |
st.session_state['ipinfo_api_key'] = os.getenv("IPINFO_API_KEY", "")
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
# --- Sidebar para la configuración de la API Key ---
|
| 21 |
with st.sidebar:
|
| 22 |
+
st.title("📄 Generador de Informes Post-Mortem asistido por IA")
|
| 23 |
+
st.write("- 📄 Completa el formulario con los detalles de la incidencia")
|
| 24 |
+
st.write("- 🚀 Presiona el botón y la IA generará un informe técnico estructurado post-mortem de tu incidente.")
|
| 25 |
|
| 26 |
# Campo de entrada para la API Key
|
| 27 |
+
if not os.getenv("OPENAI_API_KEY"):
|
| 28 |
+
st.session_state['llm_api_key'] = st.text_input(
|
| 29 |
+
"- 🔑 Ingresa tu API Key para el LLM",
|
| 30 |
type="password",
|
| 31 |
+
value=st.session_state['llm_api_key']
|
| 32 |
)
|
| 33 |
|
| 34 |
+
if st.session_state['llm_api_key']:
|
| 35 |
+
st.success("Agent API Key cargada!")
|
| 36 |
else:
|
| 37 |
+
st.warning("🚨 Por favor, ingresa tu API Key para el LLM.")
|
| 38 |
|
| 39 |
if not os.getenv("IPINFO_API_KEY"):
|
| 40 |
st.session_state['ipinfo_api_key'] = st.text_input(
|
|
|
|
| 48 |
else:
|
| 49 |
st.warning("🚨 Por favor, ingresa tu API Key de IPInfo.")
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# --- Formulario de entrada de datos principal ---
|
| 53 |
with st.form("post_mortem_form"):
|
|
|
|
| 103 |
|
| 104 |
with st.spinner("⏳ Generando informe técnico..."):
|
| 105 |
crew_response = IncidentReporterCrew(
|
| 106 |
+
api_key=st.session_state['llm_api_key'],
|
| 107 |
).crew().kickoff(inputs=inputs)
|
| 108 |
|
| 109 |
lineas = crew_response.raw.splitlines()
|
src/incident_crew.py
CHANGED
|
@@ -7,7 +7,7 @@ class IncidentReporterCrew:
|
|
| 7 |
|
| 8 |
self.llm = LLM(
|
| 9 |
#model="llama-3.3-70b-versatile",
|
| 10 |
-
model="openai/gpt-oss-120b",
|
| 11 |
temperature=0.7,
|
| 12 |
provider="openai",
|
| 13 |
)
|
|
|
|
| 7 |
|
| 8 |
self.llm = LLM(
|
| 9 |
#model="llama-3.3-70b-versatile",
|
| 10 |
+
model="openai/gpt-oss-120b:free",
|
| 11 |
temperature=0.7,
|
| 12 |
provider="openai",
|
| 13 |
)
|