ross-gpt / app.py
iasbeck's picture
Criação da classe Rag e atualização do app.py.
a21dabb
raw
history blame
709 Bytes
import streamlit as st
from rag import Rag
st.title('Echo Bot')
rag = Rag()
if "messages" not in st.session_state:
st.session_state.messages = []
for message in st.session_state.messages:
with st.chat_message(message['role']):
st.markdown(message['content'])
prompt = st.chat_input('How can I help you?')
if prompt:
with st.chat_message('user'):
st.markdown(prompt)
st.session_state.messages.append({'role': 'user', 'content': prompt})
# response = f'**Echo**: {prompt}'
response = f'{rag.get_answer(prompt)}'
with st.chat_message('assistant'):
st.markdown(response)
st.session_state.messages.append({'role': 'assistant', 'content': response})