"""
for m in st.session_state.messages:
#print(f"Printing message\t {m['role']}: {m['content']}")
s = s + f"
{m['role']}: {m['content']}
"
s = s + f"""
"""
components.html(s, height=220)
#st.markdown(s, unsafe_allow_html=True)
if not 'submitted_query' in st.session_state:
st.session_state.submitted_query = ''
if not 'messages' in st.session_state:
st.session_state.messages = []
if not 'last_user_query' in st.session_state:
st.session_state.last_user_query = ''
if utils.check_password():
st.markdown("", unsafe_allow_html=True)
if st.sidebar.button("New Conversation") or "messages" not in st.session_state:
st.session_state.assistant_thread = st.session_state.openai_client.beta.threads.create()
st.session_state.new_conversation = True
st.session_state.messages = []
st.markdown("
Raized.AI – Startups discovery demo
", unsafe_allow_html=True)
#st.write("Search for a company in free text. Describe the type of company you are looking for, the problem they solve and the solution they provide. You can also copy in the description of a similar company to kick off the search.")
st.markdown("""
""", unsafe_allow_html=True)
with open("data/countries.json", "r") as f:
countries = json.load(f)['countries']
header = st.sidebar.markdown("Filters")
#new_conversation = st.sidebar.button("New Conversation", key="new_conversation")
countries_selectbox = st.sidebar.multiselect("Country", countries, default=[])
all_regions = ('Africa', 'Europe', 'Asia & Pacific', 'North America', 'South/Latin America')
region_selectbox = st.sidebar.multiselect("Region", all_regions, default=all_regions)
all_bizmodels = ('B2B', 'B2C', 'eCommerce & Marketplace', 'Manufacturing', 'SaaS', 'Advertising', 'Commission', 'Subscription')
bizmodel_selectbox = st.sidebar.multiselect("Business Model", all_bizmodels, default=all_bizmodels)
st.markdown(
'''
''',
unsafe_allow_html=True
)
#tab_search, tab_advanced = st.tabs(["Search", "Settings"])
tab_search = st.container()
with tab_search:
#report_type = st.multiselect("Report Type", utils.get_prompts(), key="search_prompts_multiselect")
st.session_state.history_container = st.container()
with stylable_container(
key="query_panel",
css_styles="""
.stTextInput {
position: fixed;
bottom: 0px;
background: white;
z-index: 1000;
padding-bottom: 2rem;
padding-left: 1rem;
padding-right: 1rem;
padding-top: 1rem;
border-top: 1px solid whitesmoke;
height: 8rem;
border-radius: 8px 8px 8px 8px;
box-shadow: 0 -3px 3px whitesmoke;
}
""",
):
query = st.text_input(key="user_query",
label="Enter your query",
placeholder="Tell me what startups you are looking for", label_visibility="collapsed")
#cluster = st.checkbox("Cluster the results", value = False, key = "cluster")
#prompt_new = st.button("New", on_click = _prompt(prompt_title, prompt))
tab_advanced = st.sidebar.expander("Settings")
with tab_advanced:
#prompt_title = st.selectbox("Report Type", index = 0, options = utils.get_prompts(), on_change=on_prompt_selected, key="advanced_prompts_select", )
#prompt_title_editable = st.text_input("Title", key="prompt_title_editable")
report_type = st.selectbox(label="Response Type", options=["assistant", "standard", "guided", "company_list", "clustered"], index=0)
#assistant_id = st.text_input(label="Assistant ID", key="assistant_id", value = "asst_NHoxEosVlemDY7y5TYg8ftku") #value="asst_fkZtxo127nxKOCcwrwznuCs2")
assistant_id = st.selectbox(label="Assistant", options = [f"{a.id}|||{a.name}" for a in assistants])
#prompt_new = st.button("New", on_click = _prompt(prompt_title, prompt))
#prompt_delete = st.button("Del", on_click = utils.del_prompt(prompt_title_editable))
#prompt_save = st.button("Save", on_click = utils.save_prompt(prompt_title_editable, prompt))
#scrape_boost = st.number_input('Web to API content ratio', value=1.)
top_k = st.number_input('# Top Results', value=30)
is_debug = st.checkbox("Debug output", value = False, key="debug")
openai_model = st.selectbox(label="Model", options=["gpt-4-1106-preview", "gpt-3.5-turbo-16k-0613", "gpt-3.5-turbo-16k"], index=0, key="openai_model")
index_namespace = st.selectbox(label="Data Type", options=["websummarized", "web", "cbli", "all"], index=0)
liked_companies = st.text_input(label="liked companies", key='liked_companies')
disliked_companies = st.text_input(label="disliked companies", key='disliked_companies')
default_prompt = st.text_area("Default Prompt", value = utils.default_prompt, height=400, key="advanced_default_prompt_content")
clustering_prompt = st.text_area("Clustering Prompt", value = utils.clustering_prompt, height=400, key="advanced_clustering_prompt_content")
if not "assistant_thread" in st.session_state:
st.session_state.assistant_thread = st.session_state.openai_client.beta.threads.create()
if query != "" and not st.session_state.new_conversation:
# if report_type=="standard":
# prompt = default_prompt
# elif report_type=="clustered":
# prompt = clustering_prompt
# elif report_type=="guided":
# prompt = "guided"
# else:
# prompt = ""
#oai.start_conversation()
i = assistant_id.index("|||")
st.session_state.assistant_id = assistant_id[:i]
st.session_state.report_type = report_type
st.session_state.top_k = top_k
st.session_state.index_namespace = index_namespace
st.session_state.region = region_selectbox
st.session_state.country = countries_selectbox
run_query(query, report_type, top_k, region_selectbox, countries_selectbox, is_debug, index_namespace, openai_model)
else:
st.session_state.new_conversation = False