Refactor: Cleans trash files

This commit is contained in:
2025-10-23 08:32:38 -03:00
parent 42f9d22c77
commit 6b6026905e
9 changed files with 4 additions and 543 deletions

View File

@@ -1,16 +1,12 @@
import streamlit as st
from typing import Set
import requests
import json
import yaml
import st_auth
import boto3
authenticator=st_auth.get_authenticator()
from botocore.exceptions import ClientError
st_auth.st_authenticate(authenticator)
st.header("Chatbot Editais")
url="https://dcrwpxp8lj-vpce-08d695f6315d510eb.execute-api.us-east-1.amazonaws.com/dev"
url="https://i103tx5wac-vpce-03f49579eed9be4bf.execute-api.us-east-1.amazonaws.com/dev"
payload=[]
message_history=[]
if "user_prompt_history" not in st.session_state:
@@ -23,15 +19,6 @@ prompt=st.chat_input(placeholder="Digite uma mensagem...",key="prompt")
for generated_response, user_query in zip(st.session_state["chat_answer_history"],st.session_state["user_prompt_history"]):
st.chat_message("user").write(user_query)
st.chat_message("assistant").write(generated_response)
def create_sources_string(source_urls: Set[str])->str:
if not source_urls:
return ""
source_list=list(source_urls)
source_list.sort()
sources_string="source:\n"
for i, source in enumerate(source_list):
sources_string+=f"{i+1}, {source}\n"
return sources_string
if prompt:
st.chat_message("user").write(prompt)
with st.spinner("Generating response.."):
@@ -53,5 +40,4 @@ if prompt:
st.chat_message("assistant").write(formatted_response)
st.session_state["user_prompt_history"].append(prompt)
st.session_state["chat_answer_history"].append(formatted_response)
st.session_state["chat_history"]=st.session_state["chat_history"]+[{"role":"user","content":prompt}]+[{"role":"assistant","content":formatted_response}]
st.session_state.user_input=""
st.session_state["chat_history"]=st.session_state["chat_history"]+[{"role":"user","content":prompt}]+[{"role":"assistant","content":formatted_response}]