Spaces:
Sleeping
Sleeping
Commit
·
dca80da
1
Parent(s):
dad916e
feat: add message suggestion
Browse files
app.py
CHANGED
@@ -77,6 +77,12 @@ def on_click_callback():
|
|
77 |
# insert_chat_history_articles(conn, history_id, llm_response["source_documents"])
|
78 |
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
def clear_history():
|
81 |
st.session_state.history.clear()
|
82 |
st.session_state.token_count = 0
|
@@ -86,6 +92,12 @@ def clear_history():
|
|
86 |
load_css()
|
87 |
initialize_session_state()
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
with chat_column:
|
90 |
chat_placeholder = st.container()
|
91 |
prompt_placeholder = st.form("chat-form", clear_on_submit=True)
|
@@ -125,6 +137,16 @@ with chat_column:
|
|
125 |
on_click=on_click_callback,
|
126 |
)
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
st.button(":new: Start a new conversation", on_click=clear_history, type="secondary")
|
129 |
|
130 |
information_placeholder.caption(
|
|
|
77 |
# insert_chat_history_articles(conn, history_id, llm_response["source_documents"])
|
78 |
|
79 |
|
80 |
+
def exemple_message_callback_button(args):
|
81 |
+
st.session_state.human_prompt = args
|
82 |
+
send_message_callback()
|
83 |
+
st.session_state.human_prompt = ""
|
84 |
+
|
85 |
+
|
86 |
def clear_history():
|
87 |
st.session_state.history.clear()
|
88 |
st.session_state.token_count = 0
|
|
|
92 |
load_css()
|
93 |
initialize_session_state()
|
94 |
|
95 |
+
exemples = [
|
96 |
+
"Who has published influential research on quantum computing?",
|
97 |
+
"List any prominent authors in the field of artificial intelligence ethics?",
|
98 |
+
"Who are the leading experts on climate change mitigation strategies?",
|
99 |
+
]
|
100 |
+
|
101 |
with chat_column:
|
102 |
chat_placeholder = st.container()
|
103 |
prompt_placeholder = st.form("chat-form", clear_on_submit=True)
|
|
|
137 |
on_click=on_click_callback,
|
138 |
)
|
139 |
|
140 |
+
if st.session_state.token_count == 0:
|
141 |
+
information_placeholder.markdown("### Test me !")
|
142 |
+
for idx_exemple, exemple in enumerate(exemples):
|
143 |
+
information_placeholder.button(
|
144 |
+
exemple,
|
145 |
+
key=f"{idx_exemple}_button",
|
146 |
+
on_click=exemple_message_callback_button,
|
147 |
+
args=(exemple,)
|
148 |
+
)
|
149 |
+
|
150 |
st.button(":new: Start a new conversation", on_click=clear_history, type="secondary")
|
151 |
|
152 |
information_placeholder.caption(
|