import streamlit as st from model import Web_qa import time def main(): # Set up the layout -------------------------------------------------------------- st.sidebar.title("Guideline") st.sidebar.markdown(""" 1. Type your message in the chat box on the right. 2. Hit Enter or click the send button to send your message. 3. Chat bot responses will appear below. 4. Source documents will be displayed in the sidebar. """) # Button to connect to Google link ------------------------------------------------ st.sidebar.markdown('Sources', unsafe_allow_html=True) st.title("ATrad Chat App") # Chat area ----------------------------------------------------------------------- user_input = st.text_input("", key="user_input") # JavaScript code to submit the form on Enter key press js_submit = f""" document.addEventListener("keydown", function(event) {{ if (event.code === "Enter" && !event.shiftKey) {{ document.querySelector(".stTextInput").dispatchEvent(new Event("submit")); }} }}); """ st.markdown(f'', unsafe_allow_html=True) if st.button("Send"): if user_input: st.markdown(f'