File size: 916 Bytes
a576a00
b707cdc
a576a00
 
 
 
 
 
0770009
a576a00
e283888
a576a00
 
9e0a453
e283888
 
 
 
 
 
4418733
 
9201b66
95ba7e9
cd9e39e
4418733
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from PIL import Image

def set_state_if_absent(key, value):
    if key not in st.session_state:
        st.session_state[key] = value

def set_initial_state():
    set_state_if_absent("username", "Provide a Mastodon username (e.g. xyz@mastodon.social)")
    set_state_if_absent("result", None)
    set_state_if_absent("haystack_started", False)

def reset_results(*args):
    st.session_state.result = None

def set_openai_api_key(api_key: str):
    st.session_state["OPENAI_API_KEY"] = api_key

def sidebar():
    with st.sidebar:
        st.markdown(
            "## Thanks for checking this demo! 🎈\n"
            "The AI has access to the following Knowledge base: https://help.etsy.com/hc/en-us.\n\n"
            "Enter a short question about Etsy and click ASK. That's it!\n\n"
            "The app currently runs on Cohere AI but can be changed to any other LLM provider."
        )