-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbotpy.patch
More file actions
43 lines (39 loc) · 1.63 KB
/
Copy pathbotpy.patch
File metadata and controls
43 lines (39 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff --git a/bot.py b/bot.py
index 4146af0..f3fbe91 100644
--- a/bot.py
+++ b/bot.py
@@ -77,22 +77,23 @@ styl = f"""
st.markdown(styl, unsafe_allow_html=True)
+
def chat_input():
- user_input = st.chat_input("What coding issue can I help you resolve today?")
-
- if user_input:
- with st.chat_message("user"):
- st.write(user_input)
- with st.chat_message("assistant"):
- st.caption(f"RAG: {name}")
- stream_handler = StreamHandler(st.empty())
- result = output_function(
- {"question": user_input, "chat_history": []}, callbacks=[stream_handler]
- )["answer"]
- output = result
- st.session_state[f"user_input"].append(user_input)
- st.session_state[f"generated"].append(output)
- st.session_state[f"rag_mode"].append(name)
+ with st.expander("Chat inside expander"):
+ user_input = st.chat_input("What coding issue can I help you resolve today?")
+ if user_input:
+ with st.chat_message("user"):
+ st.write(user_input)
+ with st.chat_message("assistant"):
+ st.caption(f"RAG: {name}")
+ stream_handler = StreamHandler(st.empty())
+ result = output_function(
+ {"question": user_input, "chat_history": []}, callbacks=[stream_handler]
+ )["answer"]
+ output = result
+ st.session_state[f"user_input"].append(user_input)
+ st.session_state[f"generated"].append(output)
+ st.session_state[f"rag_mode"].append(name)
def display_chat():