NegotiateAI / src /utils /writer.py
Rahka's picture
Update note for inc
585c146 verified
import time
import streamlit as st
def typewriter(text: str, references: list, speed: int, app: str = "inc"):
tokens = text.split()
container = st.empty()
for index in range(len(tokens) + 1):
curr_full_text = " ".join(tokens[:index])
container.markdown(curr_full_text)
time.sleep(1 / speed)
curr_full_text += "\n"
container.markdown(curr_full_text)
if app == "knowledge_hub":
curr_full_text += "\n **Note:** \n"
curr_full_text += "\n"
curr_full_text += "This response is generated based on the available documents in the database and may not represent a comprehensive or definitive view of the topic. For complete and accurate scientific knowledge, consider consulting the original papers or additional sources. If the answer indicates that no response is possible, you may consider using a different filter or trying without any filter at all. \n"
container.markdown(curr_full_text)
if app == "inc":
curr_full_text += "\n **Note:** \n"
curr_full_text += "\n"
curr_full_text += "If the answer is that no response is possible, you may consider applying a different filter. \n"
curr_full_text += "\n While the generated answers take into account up to eight documents at a time due to technical limitations, the answer may therefore be incomplete. Please narrow down the selection of countries/associations using the filters if possible. users can still access the full set of filtered documents via direct links for comprehensive exploration. \n"
container.markdown(curr_full_text)
curr_full_text += "\n **References** \n"
curr_full_text += "\n"
container.markdown(curr_full_text)
curr_full_text += "\n".join(references)
container.markdown(curr_full_text)