Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -201,20 +201,14 @@ def add_message(history, message):
|
|
201 |
if message.strip():
|
202 |
history.append((message, None)) # Add the user's message to the chat history only if it's not empty
|
203 |
return history, "" # Clear the input box
|
204 |
-
|
205 |
-
# Define the conversation chain using the LLM and memory
|
206 |
-
conversation_chain = ConversationChain(
|
207 |
-
llm=chat_model,
|
208 |
-
memory=conversational_memory,
|
209 |
-
verbose=True
|
210 |
-
)
|
211 |
# Define function to generate a streaming response
|
212 |
def chat_with_bot(messages):
|
213 |
user_message = messages[-1][0] # Get the last user message (input)
|
214 |
messages[-1] = (user_message, "") # Prepare the placeholder for the bot's response
|
215 |
|
216 |
-
|
217 |
-
|
218 |
|
219 |
|
220 |
# Simulate streaming response by iterating over each character in the response
|
|
|
201 |
if message.strip():
|
202 |
history.append((message, None)) # Add the user's message to the chat history only if it's not empty
|
203 |
return history, "" # Clear the input box
|
204 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
# Define function to generate a streaming response
|
206 |
def chat_with_bot(messages):
|
207 |
user_message = messages[-1][0] # Get the last user message (input)
|
208 |
messages[-1] = (user_message, "") # Prepare the placeholder for the bot's response
|
209 |
|
210 |
+
response = get_response(user_message)
|
211 |
+
|
212 |
|
213 |
|
214 |
# Simulate streaming response by iterating over each character in the response
|