Spaces:
Sleeping
Sleeping
Updated context for non-help related questions. Try to add answers in scrollable div, with better overview of question and answer.
Browse files
app.py
CHANGED
|
@@ -23,9 +23,12 @@ context = read_dataset(dataset)
|
|
| 23 |
st.markdown(
|
| 24 |
"""
|
| 25 |
<style>
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
</style>
|
| 30 |
""",
|
| 31 |
unsafe_allow_html=True
|
|
@@ -47,7 +50,7 @@ def handle_submit():
|
|
| 47 |
]
|
| 48 |
else:
|
| 49 |
messages = [
|
| 50 |
-
{"role": "system", "content": f"Context:
|
| 51 |
{"role": "user", "content": user_input}
|
| 52 |
]
|
| 53 |
|
|
@@ -60,7 +63,7 @@ def handle_submit():
|
|
| 60 |
)
|
| 61 |
|
| 62 |
answer = completion.choices[0].message['content']
|
| 63 |
-
st.session_state.conversation += f"User
|
| 64 |
else:
|
| 65 |
st.write("Please enter a question.")
|
| 66 |
|
|
@@ -68,4 +71,5 @@ def handle_submit():
|
|
| 68 |
st.text_input('Ask me a question', key='user_input', on_change=handle_submit)
|
| 69 |
if st.button("Ask"):
|
| 70 |
handle_submit()
|
| 71 |
-
|
|
|
|
|
|
| 23 |
st.markdown(
|
| 24 |
"""
|
| 25 |
<style>
|
| 26 |
+
.scrollable-div {
|
| 27 |
+
max-height: 300px;
|
| 28 |
+
overflow-y: auto;
|
| 29 |
+
padding: 10px;
|
| 30 |
+
border: 1px solid #ccc;
|
| 31 |
+
background-color: #f9f9f9; }
|
| 32 |
</style>
|
| 33 |
""",
|
| 34 |
unsafe_allow_html=True
|
|
|
|
| 50 |
]
|
| 51 |
else:
|
| 52 |
messages = [
|
| 53 |
+
{"role": "system", "content": f"Context: Adrega is located in Oslo, Norway. It is a powerful project management and reporting tool. It can show Gantt diagrams, S-Curves, Tabular reports and various charts in single reports, report bundles or in a customizable dashboard."},
|
| 54 |
{"role": "user", "content": user_input}
|
| 55 |
]
|
| 56 |
|
|
|
|
| 63 |
)
|
| 64 |
|
| 65 |
answer = completion.choices[0].message['content']
|
| 66 |
+
st.session_state.conversation += f"<p><strong>User:</strong> {user_input}</p><p><strong>Adrega AI:</strong> {answer}</p>"
|
| 67 |
else:
|
| 68 |
st.write("Please enter a question.")
|
| 69 |
|
|
|
|
| 71 |
st.text_input('Ask me a question', key='user_input', on_change=handle_submit)
|
| 72 |
if st.button("Ask"):
|
| 73 |
handle_submit()
|
| 74 |
+
|
| 75 |
+
st.markdown(f'<div class="scrollable-div">{st.session_state.conversation}</div>', unsafe_allow_html=True)
|