Update app.py
Browse files
app.py
CHANGED
@@ -209,13 +209,13 @@ def Chat_Message(history):
|
|
209 |
message=HumanMessage(content=history[-1][0])
|
210 |
messages1.append(message)
|
211 |
response = chat_model.invoke(messages1)
|
212 |
-
messages1.append(AIMessage(content=response))
|
213 |
|
214 |
if len(messages1) >= 8:
|
215 |
messages1 = messages1[-8:]
|
216 |
|
217 |
history[-1][1] = ""
|
218 |
-
for character in response:
|
219 |
history[-1][1] += character
|
220 |
time.sleep(0.0025)
|
221 |
yield history
|
@@ -244,13 +244,13 @@ def Web_Search(history):
|
|
244 |
msg=HumanMessage(content=augmented_prompt)
|
245 |
messages2.append(msg)
|
246 |
response = chat_model.invoke(messages2)
|
247 |
-
messages2.append(AIMessage(content=response))
|
248 |
|
249 |
if len(messages2) >= 8:
|
250 |
messages2 = messages2[-8:]
|
251 |
|
252 |
history[-1][1] = ""
|
253 |
-
for character in response:
|
254 |
history[-1][1] += character
|
255 |
time.sleep(0.0025)
|
256 |
yield history
|
@@ -272,12 +272,12 @@ def Chart_Generator(history):
|
|
272 |
messages3.append(prompt)
|
273 |
|
274 |
response = chat_model.invoke(messages3)
|
275 |
-
messages3.append(AIMessage(content=response))
|
276 |
|
277 |
if len(messages3) >= 8:
|
278 |
messages3 = messages3[-8:]
|
279 |
|
280 |
-
combined_content = f'{image_html}<br>{response}'
|
281 |
else:
|
282 |
response_text = "Can't generate this image. Please provide valid chart details."
|
283 |
combined_content = response_text
|
@@ -286,12 +286,12 @@ def Chart_Generator(history):
|
|
286 |
messages3.append(prompt)
|
287 |
|
288 |
response = chat_model.invoke(messages3)
|
289 |
-
messages3.append(AIMessage(content=response))
|
290 |
|
291 |
if len(messages3) >= 8:
|
292 |
messages3 = messages3[-8:]
|
293 |
|
294 |
-
combined_content=response
|
295 |
|
296 |
history[-1][1] = ""
|
297 |
for character in combined_content:
|
@@ -334,12 +334,12 @@ def Link_Scratch(history):
|
|
334 |
message = HumanMessage(content=augmented_prompt)
|
335 |
messages4.append(message)
|
336 |
response = chat_model.invoke(messages4)
|
337 |
-
messages4.append(AIMessage(content=response))
|
338 |
|
339 |
if len(messages4) >= 1:
|
340 |
messages4 = messages4[-1:]
|
341 |
|
342 |
-
response_message = response
|
343 |
|
344 |
history[-1][1] = ""
|
345 |
for character in response_message:
|
@@ -392,12 +392,12 @@ def File_Interact(history,filepath):
|
|
392 |
message = HumanMessage(content=augmented_prompt)
|
393 |
messages5.append(message)
|
394 |
response = chat_model.invoke(messages5)
|
395 |
-
messages5.append(AIMessage(content=response))
|
396 |
|
397 |
if len(messages5) >= 1:
|
398 |
messages5 = messages5[-1:]
|
399 |
|
400 |
-
response_message = response
|
401 |
|
402 |
history[-1][1] = ""
|
403 |
for character in response_message:
|
|
|
209 |
message=HumanMessage(content=history[-1][0])
|
210 |
messages1.append(message)
|
211 |
response = chat_model.invoke(messages1)
|
212 |
+
messages1.append(AIMessage(content=response.content))
|
213 |
|
214 |
if len(messages1) >= 8:
|
215 |
messages1 = messages1[-8:]
|
216 |
|
217 |
history[-1][1] = ""
|
218 |
+
for character in response.content:
|
219 |
history[-1][1] += character
|
220 |
time.sleep(0.0025)
|
221 |
yield history
|
|
|
244 |
msg=HumanMessage(content=augmented_prompt)
|
245 |
messages2.append(msg)
|
246 |
response = chat_model.invoke(messages2)
|
247 |
+
messages2.append(AIMessage(content=response.content))
|
248 |
|
249 |
if len(messages2) >= 8:
|
250 |
messages2 = messages2[-8:]
|
251 |
|
252 |
history[-1][1] = ""
|
253 |
+
for character in response.content:
|
254 |
history[-1][1] += character
|
255 |
time.sleep(0.0025)
|
256 |
yield history
|
|
|
272 |
messages3.append(prompt)
|
273 |
|
274 |
response = chat_model.invoke(messages3)
|
275 |
+
messages3.append(AIMessage(content=response.content))
|
276 |
|
277 |
if len(messages3) >= 8:
|
278 |
messages3 = messages3[-8:]
|
279 |
|
280 |
+
combined_content = f'{image_html}<br>{response.content}'
|
281 |
else:
|
282 |
response_text = "Can't generate this image. Please provide valid chart details."
|
283 |
combined_content = response_text
|
|
|
286 |
messages3.append(prompt)
|
287 |
|
288 |
response = chat_model.invoke(messages3)
|
289 |
+
messages3.append(AIMessage(content=response.content))
|
290 |
|
291 |
if len(messages3) >= 8:
|
292 |
messages3 = messages3[-8:]
|
293 |
|
294 |
+
combined_content=response.content
|
295 |
|
296 |
history[-1][1] = ""
|
297 |
for character in combined_content:
|
|
|
334 |
message = HumanMessage(content=augmented_prompt)
|
335 |
messages4.append(message)
|
336 |
response = chat_model.invoke(messages4)
|
337 |
+
messages4.append(AIMessage(content=response.content))
|
338 |
|
339 |
if len(messages4) >= 1:
|
340 |
messages4 = messages4[-1:]
|
341 |
|
342 |
+
response_message = response.content
|
343 |
|
344 |
history[-1][1] = ""
|
345 |
for character in response_message:
|
|
|
392 |
message = HumanMessage(content=augmented_prompt)
|
393 |
messages5.append(message)
|
394 |
response = chat_model.invoke(messages5)
|
395 |
+
messages5.append(AIMessage(content=response.content))
|
396 |
|
397 |
if len(messages5) >= 1:
|
398 |
messages5 = messages5[-1:]
|
399 |
|
400 |
+
response_message = response.content
|
401 |
|
402 |
history[-1][1] = ""
|
403 |
for character in response_message:
|