import streamlit as st from streamlit_chat import message from streamlit_extras.colored_header import colored_header from streamlit_extras.add_vertical_space import add_vertical_space import uuid import sys import json import os import requests import uuid AI_ICON = "aws.png" base_url = os.getenv('BASE_URL') headers = {'Content-Type': 'application/json'} st.set_page_config(page_title="AWSomeChat - An LLM-powered chatbot on AWS documentation") # Sidebar contents with st.sidebar: st.title('🤗💬 AWSomeChat App') st.markdown(''' ## About This app is an LLM-powered chatbot built using: - [Streamlit](https://streamlit.io/) - [Amazon SageMaker](https://aws.amazon.com/sagemaker/) - [Amazon Kendra](https://aws.amazon.com/kendra/) ''') add_vertical_space(5) st.write('Made with ❤️ by your AWS WWSO AIML EMEA Team') st.markdown(""" """, unsafe_allow_html=True) def create_session_id(): return str(uuid.uuid4()) # Create or get the session state def get_session(): if 'session_id' not in st.session_state: st.session_state.session_id = create_session_id() return st.session_state.session_id session_id = get_session() # Refresh button callback def refresh(): session_id = create_session_id() st.session_state.session_id = session_id st.session_state['generated'] = ["Hi, I'm AWSomeChat. I have lots of information on AWS documentation. How may I help you?"] st.session_state['past'] = [] def clear(): st.session_state.session_id = session_id st.session_state['generated'] = ["Hi, I'm AWSomeChat. I have lots of information on AWS documentation. How may I help you?"] st.session_state['past'] = [] st.session_state['input'] = "" def write_logo(): col1, col2, col3 = st.columns([5, 1, 5]) with col2: st.image(AI_ICON, use_column_width='always') def write_top_bar(): col1, col2, col3, col4 = st.columns([1,10,2,2]) with col1: st.image(AI_ICON, use_column_width='always') with col2: st.write(f"