Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def obtener_respuesta(pregunta, texto_preprocesado, modelo, temperatura=0.5, ass
|
|
| 63 |
response = openai.ChatCompletion.create(
|
| 64 |
model=modelo,
|
| 65 |
messages=[
|
| 66 |
-
{"role": "system", "content": "
|
| 67 |
{"role": "user", "content": f"{contexto}\n\n{pregunta}\n\nContexto: {texto_preprocesado}"}
|
| 68 |
],
|
| 69 |
temperature=temperatura
|
|
@@ -99,7 +99,7 @@ def obtener_respuesta(pregunta, texto_preprocesado, modelo, temperatura=0.5, ass
|
|
| 99 |
|
| 100 |
def guardar_en_txt(nombre_archivo, datos):
|
| 101 |
carpeta = "datos_guardados"
|
| 102 |
-
os.makedirs(carpeta,
|
| 103 |
ruta_archivo = os.path.join(carpeta, nombre_archivo)
|
| 104 |
try:
|
| 105 |
with open(ruta_archivo, 'a', encoding='utf-8') as archivo: # Append mode
|
|
@@ -623,14 +623,13 @@ def mostrar_galatea_asistente():
|
|
| 623 |
<style>
|
| 624 |
#video-container {
|
| 625 |
position: relative;
|
| 626 |
-
width:
|
| 627 |
-
height:
|
| 628 |
background-color: lightblue;
|
| 629 |
overflow: hidden;
|
| 630 |
display: flex;
|
| 631 |
justify-content: center;
|
| 632 |
align-items: center;
|
| 633 |
-
margin: auto;
|
| 634 |
}
|
| 635 |
#background-video {
|
| 636 |
width: 100%;
|
|
@@ -659,7 +658,6 @@ def mostrar_galatea_asistente():
|
|
| 659 |
align-self: flex-end;
|
| 660 |
background: rgba(0, 123, 255, 0.8);
|
| 661 |
color: white;
|
| 662 |
-
border-color: #0056b3;
|
| 663 |
}
|
| 664 |
</style>
|
| 665 |
<div id="video-container">
|
|
@@ -706,7 +704,7 @@ def manejar_pregunta_usuario(pregunta_usuario, archivo_pdf=None, contexto=""):
|
|
| 706 |
response = openai.ChatCompletion.create(
|
| 707 |
model=st.session_state['modelo'],
|
| 708 |
messages=[
|
| 709 |
-
{"role": "system", "content": "Act煤a como Galatea, la asistente de la cl铆nica
|
| 710 |
{"role": "user", "content": prompt}
|
| 711 |
],
|
| 712 |
temperature=st.session_state['temperatura'],
|
|
@@ -754,7 +752,7 @@ def manejar_pregunta_usuario(pregunta_usuario, archivo_pdf=None, contexto=""):
|
|
| 754 |
st.markdown(f"<script>document.getElementById('background-video').play();</script>", unsafe_allow_html=True)
|
| 755 |
|
| 756 |
# Almacenar la informaci贸n importante en la memoria
|
| 757 |
-
if "nombre"
|
| 758 |
st.session_state['memoria']['煤ltima_interacci贸n'] = pregunta_usuario
|
| 759 |
guardar_en_txt('memoria_asistente.txt', f"脷ltima interacci贸n: {pregunta_usuario}")
|
| 760 |
|
|
|
|
| 63 |
response = openai.ChatCompletion.create(
|
| 64 |
model=modelo,
|
| 65 |
messages=[
|
| 66 |
+
{"role": "system", "content": "Actua como Galatea la asistente de la clinica Odontologica OMARDENT y resuelve las inquietudes"},
|
| 67 |
{"role": "user", "content": f"{contexto}\n\n{pregunta}\n\nContexto: {texto_preprocesado}"}
|
| 68 |
],
|
| 69 |
temperature=temperatura
|
|
|
|
| 99 |
|
| 100 |
def guardar_en_txt(nombre_archivo, datos):
|
| 101 |
carpeta = "datos_guardados"
|
| 102 |
+
os.makedirs(carpeta, exist_ok=True)
|
| 103 |
ruta_archivo = os.path.join(carpeta, nombre_archivo)
|
| 104 |
try:
|
| 105 |
with open(ruta_archivo, 'a', encoding='utf-8') as archivo: # Append mode
|
|
|
|
| 623 |
<style>
|
| 624 |
#video-container {
|
| 625 |
position: relative;
|
| 626 |
+
width: 100%;
|
| 627 |
+
height: 40vh;
|
| 628 |
background-color: lightblue;
|
| 629 |
overflow: hidden;
|
| 630 |
display: flex;
|
| 631 |
justify-content: center;
|
| 632 |
align-items: center;
|
|
|
|
| 633 |
}
|
| 634 |
#background-video {
|
| 635 |
width: 100%;
|
|
|
|
| 658 |
align-self: flex-end;
|
| 659 |
background: rgba(0, 123, 255, 0.8);
|
| 660 |
color: white;
|
|
|
|
| 661 |
}
|
| 662 |
</style>
|
| 663 |
<div id="video-container">
|
|
|
|
| 704 |
response = openai.ChatCompletion.create(
|
| 705 |
model=st.session_state['modelo'],
|
| 706 |
messages=[
|
| 707 |
+
{"role": "system", "content": "Act煤a como Galatea, la asistente de la cl铆nica Odontol贸gica OMARDENT, y resuelve las inquietudes."},
|
| 708 |
{"role": "user", "content": prompt}
|
| 709 |
],
|
| 710 |
temperature=st.session_state['temperatura'],
|
|
|
|
| 752 |
st.markdown(f"<script>document.getElementById('background-video').play();</script>", unsafe_allow_html=True)
|
| 753 |
|
| 754 |
# Almacenar la informaci贸n importante en la memoria
|
| 755 |
+
if "nombre" in pregunta_usuario.lower() or "tel茅fono" in pregunta_usuario.lower():
|
| 756 |
st.session_state['memoria']['煤ltima_interacci贸n'] = pregunta_usuario
|
| 757 |
guardar_en_txt('memoria_asistente.txt', f"脷ltima interacci贸n: {pregunta_usuario}")
|
| 758 |
|