Spaces:
Runtime error
Runtime error
clarified buttons
Browse files
app.py
CHANGED
|
@@ -77,25 +77,16 @@ rag_chain = (
|
|
| 77 |
|
| 78 |
st.title("🐔 Volker-Chat")
|
| 79 |
|
| 80 |
-
def click_button(
|
| 81 |
st.session_state.clicked = True
|
| 82 |
-
st.session_state['
|
| 83 |
-
|
| 84 |
-
def predefined_question(btn):
|
| 85 |
-
if btn == "btn_1":
|
| 86 |
-
prompt = "Erläutere die Säule 'Lernen' aus der Volker-App."
|
| 87 |
-
elif btn == "btn_2":
|
| 88 |
-
prompt = "Erläutere die Säule 'Tracken' aus der Volker-App."
|
| 89 |
-
elif btn == "btn_3":
|
| 90 |
-
prompt = "Erläutere die Säule 'Handeln' aus der Volker-App."
|
| 91 |
-
return prompt
|
| 92 |
|
| 93 |
c = st.container()
|
| 94 |
c.write("Beispielfragen")
|
| 95 |
col1, col2, col3 = c.columns(3)
|
| 96 |
-
col1.button("Was ist 'Lernen'?", on_click=click_button, args=['
|
| 97 |
-
col2.button("Was ist 'Tracken'?", on_click=click_button, args=['
|
| 98 |
-
col3.button("Was ist 'Handeln'?", on_click=click_button, args=['
|
| 99 |
|
| 100 |
if 'clicked' not in st.session_state:
|
| 101 |
st.session_state.clicked = False
|
|
@@ -107,7 +98,7 @@ for msg in st.session_state.messages:
|
|
| 107 |
st.chat_message(msg["role"]).write(msg["content"])
|
| 108 |
|
| 109 |
if st.session_state.clicked:
|
| 110 |
-
prompt =
|
| 111 |
st.chat_message("user").write(prompt)
|
| 112 |
with get_openai_callback() as cb:
|
| 113 |
response = rag_chain.invoke(prompt)
|
|
|
|
| 77 |
|
| 78 |
st.title("🐔 Volker-Chat")
|
| 79 |
|
| 80 |
+
def click_button(prompt):
|
| 81 |
st.session_state.clicked = True
|
| 82 |
+
st.session_state['prompt'] = prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
c = st.container()
|
| 85 |
c.write("Beispielfragen")
|
| 86 |
col1, col2, col3 = c.columns(3)
|
| 87 |
+
col1.button("Was ist 'Lernen'?", on_click=click_button, args=["Erläutere die Säule 'Lernen' der Volker-App."])
|
| 88 |
+
col2.button("Was ist 'Tracken'?", on_click=click_button, args=["Erläutere die Säule 'Tracken' der Volker-App."])
|
| 89 |
+
col3.button("Was ist 'Handeln'?", on_click=click_button, args=["Erläutere die Säule 'Handeln' der Volker-App."])
|
| 90 |
|
| 91 |
if 'clicked' not in st.session_state:
|
| 92 |
st.session_state.clicked = False
|
|
|
|
| 98 |
st.chat_message(msg["role"]).write(msg["content"])
|
| 99 |
|
| 100 |
if st.session_state.clicked:
|
| 101 |
+
prompt = st.session_state['prompt']
|
| 102 |
st.chat_message("user").write(prompt)
|
| 103 |
with get_openai_callback() as cb:
|
| 104 |
response = rag_chain.invoke(prompt)
|