|
import streamlit as st |
|
import os |
|
import pandas as pd |
|
from model import create_agent |
|
from dotenv import load_dotenv |
|
from config import PROMPT |
|
|
|
st.set_page_config(page_title="Appointment Booking Bot", page_icon="π₯") |
|
|
|
|
|
load_dotenv() |
|
|
|
API_KEY = os.environ["API_KEY"] |
|
|
|
|
|
general_prompt_template=PROMPT |
|
|
|
|
|
@st.cache_resource |
|
def get_agent(): |
|
return create_agent(general_prompt_template) |
|
|
|
agent = get_agent() |
|
|
|
|
|
st.title("Appointment Booking Bot") |
|
st.write("**NOTE:** Currently the slots are getting booked/reshedule/delete in Google Calender in the specific account whose credentials are provided.") |
|
|
|
|
|
if "messages" not in st.session_state: |
|
st.session_state.messages = [] |
|
|
|
|
|
for message in st.session_state.messages: |
|
with st.chat_message(message["role"]): |
|
st.markdown(message["content"]) |
|
|
|
|
|
if prompt := st.chat_input("What is your query?"): |
|
|
|
st.chat_message("user").markdown(prompt) |
|
|
|
st.session_state.messages.append({"role": "user", "content": prompt}) |
|
|
|
response = agent.invoke({"input": prompt})['output'] |
|
|
|
|
|
with st.chat_message("assistant"): |
|
st.markdown(response) |
|
|
|
st.session_state.messages.append({"role": "assistant", "content": response}) |
|
|
|
|
|
def main(): |
|
st.sidebar.title("About") |
|
st.sidebar.info(""" |
|
π₯ **Appointment Booking Bot** |
|
|
|
π©Ί Virtual Appointment Managing |
|
|
|
π **Key Features:** |
|
- Appointment management: |
|
|
|
π
**Book appointments** |
|
π **Reschedule appointments** |
|
ποΈ **Delete appointments** |
|
|
|
β° **Appointment Availability:** |
|
- Monday to Friday |
|
- 10 AM to 7 PM |
|
- Book up to 7 days in advance |
|
|
|
β οΈ **Important Note:** |
|
This app is for managing your appointment using google Calender! |
|
""") |
|
|
|
col1, col2 = st.sidebar.columns([2, 1]) |
|
|
|
|
|
with col1: |
|
st.markdown("π€ **SIMRAN**") |
|
|
|
|
|
with col2: |
|
logout_button = st.button("Logout", key="logout", help="Click to logout", use_container_width=True) |
|
|
|
if __name__ == "__main__": |
|
main() |