ofermend commited on
Commit
d7f8ae3
1 Parent(s): 84cbd45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -26
app.py CHANGED
@@ -27,6 +27,7 @@ def launch_bot():
27
  })
28
  st.session_state.cfg = cfg
29
  st.session_state.vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids)
 
30
 
31
  cfg = st.session_state.cfg
32
  vq = st.session_state.vq
@@ -53,10 +54,6 @@ def launch_bot():
53
 
54
  if "messages" not in st.session_state.keys():
55
  st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
56
-
57
- if "messages" not in st.session_state:
58
- st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
59
- st.session_state.first_round = True
60
 
61
  # Display chat messages
62
  for message in st.session_state.messages:
@@ -74,28 +71,6 @@ def launch_bot():
74
  if prompt := st.chat_input("Ask me anything..."):
75
  process_prompt(prompt) # Process the user-provided prompt
76
 
77
-
78
- # Display chat messages
79
- # for message in st.session_state.messages:
80
- # with st.chat_message(message["role"]):
81
- # st.write(message["content"])
82
-
83
- # User-provided prompt
84
- # if prompt := st.chat_input():
85
- # st.session_state.messages.append({"role": "user", "content": prompt})
86
- # with st.chat_message("user"):
87
- # st.write(prompt)
88
-
89
- # Generate a new response if last message is not from assistant
90
- # if st.session_state.messages[-1]["role"] != "assistant":
91
- # with st.chat_message("assistant"):
92
- # with st.spinner("Thinking..."):
93
- # response = generate_response(prompt)
94
- # st.write(response)
95
- # message = {"role": "assistant", "content": response}
96
- # st.session_state.messages.append(message)
97
-
98
-
99
  def process_prompt(prompt):
100
  # Your logic to process the prompt and generate response
101
  st.session_state.messages.append({"role": "user", "content": prompt})
 
27
  })
28
  st.session_state.cfg = cfg
29
  st.session_state.vq = VectaraQuery(cfg.api_key, cfg.customer_id, cfg.corpus_ids)
30
+ st.session_state.first_round = True
31
 
32
  cfg = st.session_state.cfg
33
  vq = st.session_state.vq
 
54
 
55
  if "messages" not in st.session_state.keys():
56
  st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
 
 
 
 
57
 
58
  # Display chat messages
59
  for message in st.session_state.messages:
 
71
  if prompt := st.chat_input("Ask me anything..."):
72
  process_prompt(prompt) # Process the user-provided prompt
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  def process_prompt(prompt):
75
  # Your logic to process the prompt and generate response
76
  st.session_state.messages.append({"role": "user", "content": prompt})