karora1804 commited on
Commit
cd451ae
·
verified ·
1 Parent(s): 29602c4

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -7,11 +7,8 @@ from langchain_core.messages import SystemMessage, HumanMessage
7
  # from chatbot_utils import get_components
8
  warnings.filterwarnings("ignore")
9
 
10
- st.title("🍔 FoodHub AI Concierge")
11
 
12
- st.write("tools fetched")
13
- # Load LLM and Tools from our utils file
14
- st.write("Agent about to initialized")
15
  if "agent" not in st.session_state:
16
  tools = [order_query_tool, answer_tool]
17
  #llm, tools = get_components()
@@ -22,27 +19,29 @@ if "agent" not in st.session_state:
22
  verbose=False,
23
  handle_parsing_errors=True
24
  )
 
25
  st.session_state.chat_history = []
26
- st.write("Agent initialized")
27
 
28
  if "chat_history" not in st.session_state:
29
  st.session_state.chat_history = []
30
 
31
- # 2. ALWAYS display the conversation history first
32
  # This ensures that even when the script reruns, your previous messages stay visible
33
  for message in st.session_state.chat_history:
34
  if isinstance(message, HumanMessage):
35
  st.chat_message("user").write(message.content)
36
 
37
- # Chat input (appears at bottom of page automatically)
38
- #if user_input := st.chat_input("Where is my order O12514?"):
39
- # Log user message
40
- # Display assistant response
41
 
 
 
42
  # Chat Interface
43
- if prompt := st.chat_input("Where is my order O12514?"):
 
 
 
 
 
44
  st.chat_message("user").write(prompt)
45
- st.write("processing user input")
46
  with st.spinner("Searching..."):
47
  try:
48
  response = st.session_state.agent.invoke({
 
7
  # from chatbot_utils import get_components
8
  warnings.filterwarnings("ignore")
9
 
10
+ st.title("🍔 FoodDelivery Chat Bot Agent....")
11
 
 
 
 
12
  if "agent" not in st.session_state:
13
  tools = [order_query_tool, answer_tool]
14
  #llm, tools = get_components()
 
19
  verbose=False,
20
  handle_parsing_errors=True
21
  )
22
+ # cleaning up the history
23
  st.session_state.chat_history = []
 
24
 
25
  if "chat_history" not in st.session_state:
26
  st.session_state.chat_history = []
27
 
28
+ # ALWAYS display the conversation history first
29
  # This ensures that even when the script reruns, your previous messages stay visible
30
  for message in st.session_state.chat_history:
31
  if isinstance(message, HumanMessage):
32
  st.chat_message("user").write(message.content)
33
 
 
 
 
 
34
 
35
+ # As of now login setup is not provided hence keeping the customer id hard coded
36
+ cust_id = 'C1011'
37
  # Chat Interface
38
+ if prompt := st.chat_input("Where is my order"):
39
+
40
+ # appending hard coded customer id as of now
41
+ # in future once customer comes with login, we can use login
42
+ # information to fetch the customer id
43
+ prompt += f" where cust_id is {cust_id}"
44
  st.chat_message("user").write(prompt)
 
45
  with st.spinner("Searching..."):
46
  try:
47
  response = st.session_state.agent.invoke({