Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ llm_chain = LLMChain(
|
|
| 31 |
|
| 32 |
previous_response = ""
|
| 33 |
def conversational_chat(user_query):
|
| 34 |
-
previous_response = "".join([f"
|
| 35 |
result = llm_chain.predict(
|
| 36 |
question=user_query,
|
| 37 |
previous_history = previous_response
|
|
@@ -65,10 +65,10 @@ with container:
|
|
| 65 |
st.session_state['assistant'].append(output)
|
| 66 |
|
| 67 |
|
| 68 |
-
#
|
| 69 |
if st.session_state['assistant']:
|
| 70 |
with response_container:
|
| 71 |
for i in range(len(st.session_state['assistant'])):
|
| 72 |
if i != 0:
|
| 73 |
message(st.session_state["human"][i], is_user=True, key=str(i) + '_user', avatar_style="adventurer")
|
| 74 |
-
message(st.session_state["assistant"][i], key=str(i), avatar_style="bottts")
|
|
|
|
| 31 |
|
| 32 |
previous_response = ""
|
| 33 |
def conversational_chat(user_query):
|
| 34 |
+
previous_response = "".join([f"User: {i[0]}\nChatbot: {i[1]}" for i in st.session_state['history'] if i is not None])
|
| 35 |
result = llm_chain.predict(
|
| 36 |
question=user_query,
|
| 37 |
previous_history = previous_response
|
|
|
|
| 65 |
st.session_state['assistant'].append(output)
|
| 66 |
|
| 67 |
|
| 68 |
+
# Display chat history
|
| 69 |
if st.session_state['assistant']:
|
| 70 |
with response_container:
|
| 71 |
for i in range(len(st.session_state['assistant'])):
|
| 72 |
if i != 0:
|
| 73 |
message(st.session_state["human"][i], is_user=True, key=str(i) + '_user', avatar_style="adventurer")
|
| 74 |
+
message(st.session_state["assistant"][i], key=str(i), avatar_style="bottts")
|