Josedcape commited on
Commit
4d0f960
verified
1 Parent(s): a419805

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -42
app.py CHANGED
@@ -10,15 +10,13 @@ from utils.data_manager import (
10
  buscar_datos_guardados,
11
  generar_notificaciones_pendientes,
12
  flujo_presupuestos,
13
- flujo_radiografias
 
14
  )
15
  import tempfile
16
  from dotenv import load_dotenv
17
  from flask import Flask, request, jsonify
18
  import threading
19
- from google.oauth2.service_account import Credentials
20
- from googleapiclient.discovery import build
21
- from datetime import datetime, timedelta
22
 
23
  # Cargar las claves API desde el archivo .env
24
  load_dotenv()
@@ -102,9 +100,9 @@ def manejar_pregunta_usuario(pregunta_usuario, archivo_pdf):
102
  texto_preprocesado = preprocesar_texto(texto_pdf)
103
 
104
  respuesta = obtener_respuesta(
105
- pregunta_usuario,
106
- texto_preprocesado,
107
- st.session_state['modelo'],
108
  st.session_state['temperatura'],
109
  st.session_state.get('assistant_id', '')
110
  )
@@ -209,41 +207,6 @@ def consultar_google_calendar(pregunta):
209
  eventos.append(f"{event['summary']} at {start}")
210
  return '\n'.join(eventos)
211
 
212
- def agregar_evento_google_calendar(summary, location, description, start_time, end_time):
213
- SCOPES = ['https://www.googleapis.com/auth/calendar']
214
- creds = None
215
-
216
- if not os.path.exists('service_account.json'):
217
- return 'Error: archivo service_account.json no encontrado.'
218
-
219
- creds = Credentials.from_service_account_file('service_account.json', scopes=SCOPES)
220
-
221
- service = build('calendar', 'v3', credentials=creds)
222
-
223
- event = {
224
- 'summary': summary,
225
- 'location': location,
226
- 'description': description,
227
- 'start': {
228
- 'dateTime': start_time,
229
- 'timeZone': 'America/Bogota',
230
- },
231
- 'end': {
232
- 'dateTime': end_time,
233
- 'timeZone': 'America/Bogota',
234
- },
235
- 'reminders': {
236
- 'useDefault': False,
237
- 'overrides': [
238
- {'method': 'email', 'minutes': 24 * 60},
239
- {'method': 'popup', 'minutes': 10},
240
- ],
241
- },
242
- }
243
-
244
- event = service.events().insert(calendarId='primary', body=event).execute()
245
- return f'Event created: {event.get("htmlLink")}'
246
-
247
  def mostrar_paginas():
248
  st.sidebar.title("Navegaci贸n")
249
  page = st.sidebar.radio("Ir a", ["P谩gina Principal", "Gesti贸n de Trabajos", "Gesti贸n de Insumos", "Registro de Radiograf铆as", "Buscar Datos", "Notificaciones", "Recomendaciones", "Asistente de Presupuestos", "Comunicaci贸n", "Asistente de Agendamiento"])
 
10
  buscar_datos_guardados,
11
  generar_notificaciones_pendientes,
12
  flujo_presupuestos,
13
+ flujo_radiografias,
14
+ agregar_evento_google_calendar
15
  )
16
  import tempfile
17
  from dotenv import load_dotenv
18
  from flask import Flask, request, jsonify
19
  import threading
 
 
 
20
 
21
  # Cargar las claves API desde el archivo .env
22
  load_dotenv()
 
100
  texto_preprocesado = preprocesar_texto(texto_pdf)
101
 
102
  respuesta = obtener_respuesta(
103
+ pregunta_usuario,
104
+ texto_preprocesado,
105
+ st.session_state['modelo'],
106
  st.session_state['temperatura'],
107
  st.session_state.get('assistant_id', '')
108
  )
 
207
  eventos.append(f"{event['summary']} at {start}")
208
  return '\n'.join(eventos)
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  def mostrar_paginas():
211
  st.sidebar.title("Navegaci贸n")
212
  page = st.sidebar.radio("Ir a", ["P谩gina Principal", "Gesti贸n de Trabajos", "Gesti贸n de Insumos", "Registro de Radiograf铆as", "Buscar Datos", "Notificaciones", "Recomendaciones", "Asistente de Presupuestos", "Comunicaci贸n", "Asistente de Agendamiento"])