Update app.py
Browse files
app.py
CHANGED
@@ -206,12 +206,12 @@ def Chat_Message(history):
|
|
206 |
global messages1
|
207 |
|
208 |
message=HumanMessage(content=history[-1][0])
|
209 |
-
|
210 |
-
response = chat_model.invoke(
|
211 |
-
|
212 |
|
213 |
-
if len(
|
214 |
-
|
215 |
|
216 |
history[-1][1] = ""
|
217 |
for character in response.content:
|
@@ -239,12 +239,12 @@ def Web_Search(history):
|
|
239 |
"""
|
240 |
|
241 |
msg=HumanMessage(content=augmented_prompt)
|
242 |
-
|
243 |
-
response = chat_model.invoke(
|
244 |
-
|
245 |
|
246 |
-
if len(
|
247 |
-
|
248 |
|
249 |
history[-1][1] = ""
|
250 |
for character in response.content:
|
@@ -266,13 +266,13 @@ def Chart_Generator(history):
|
|
266 |
message_with_description = f"Describe and analyse the content of this chart: {chart_url}"
|
267 |
|
268 |
prompt = HumanMessage(content=message_with_description)
|
269 |
-
|
270 |
|
271 |
-
response = chat_model.invoke(
|
272 |
-
|
273 |
|
274 |
-
if len(
|
275 |
-
|
276 |
|
277 |
combined_content = f'{image_html}<br>{response.content}'
|
278 |
else:
|
@@ -280,13 +280,13 @@ def Chart_Generator(history):
|
|
280 |
combined_content = response_text
|
281 |
else:
|
282 |
prompt = HumanMessage(content=message)
|
283 |
-
|
284 |
|
285 |
-
response = chat_model.invoke(
|
286 |
-
|
287 |
|
288 |
-
if len(
|
289 |
-
|
290 |
|
291 |
combined_content=response.content
|
292 |
|
@@ -327,12 +327,12 @@ def Link_Scratch(history):
|
|
327 |
{content_data}
|
328 |
"""
|
329 |
message = HumanMessage(content=augmented_prompt)
|
330 |
-
|
331 |
-
response = chat_model.invoke(
|
332 |
-
|
333 |
|
334 |
-
if len(
|
335 |
-
|
336 |
|
337 |
response_message = response.content
|
338 |
|
@@ -383,12 +383,12 @@ def File_Interact(history,filepath):
|
|
383 |
{content_data}
|
384 |
"""
|
385 |
message = HumanMessage(content=augmented_prompt)
|
386 |
-
|
387 |
-
response = chat_model.invoke(
|
388 |
-
|
389 |
|
390 |
-
if len(
|
391 |
-
|
392 |
|
393 |
response_message = response.content
|
394 |
|
|
|
206 |
global messages1
|
207 |
|
208 |
message=HumanMessage(content=history[-1][0])
|
209 |
+
messages1.append(message)
|
210 |
+
response = chat_model.invoke(messages1)
|
211 |
+
messages1.append(AIMessage(content=response.content))
|
212 |
|
213 |
+
if len(messages1) >= 8:
|
214 |
+
messages1 = messages1[-8:]
|
215 |
|
216 |
history[-1][1] = ""
|
217 |
for character in response.content:
|
|
|
239 |
"""
|
240 |
|
241 |
msg=HumanMessage(content=augmented_prompt)
|
242 |
+
messages2.append(msg)
|
243 |
+
response = chat_model.invoke(messages2)
|
244 |
+
messages2.append(AIMessage(content=response.content))
|
245 |
|
246 |
+
if len(messages2) >= 8:
|
247 |
+
messages2 = messages2[-8:]
|
248 |
|
249 |
history[-1][1] = ""
|
250 |
for character in response.content:
|
|
|
266 |
message_with_description = f"Describe and analyse the content of this chart: {chart_url}"
|
267 |
|
268 |
prompt = HumanMessage(content=message_with_description)
|
269 |
+
messages3.append(prompt)
|
270 |
|
271 |
+
response = chat_model.invoke(messages3)
|
272 |
+
messages3.append(AIMessage(content=response.content))
|
273 |
|
274 |
+
if len(messages3) >= 8:
|
275 |
+
messages3 = messages3[-8:]
|
276 |
|
277 |
combined_content = f'{image_html}<br>{response.content}'
|
278 |
else:
|
|
|
280 |
combined_content = response_text
|
281 |
else:
|
282 |
prompt = HumanMessage(content=message)
|
283 |
+
messages3.append(prompt)
|
284 |
|
285 |
+
response = chat_model.invoke(messages3)
|
286 |
+
messages3.append(AIMessage(content=response.content))
|
287 |
|
288 |
+
if len(messages3) >= 8:
|
289 |
+
messages3 = messages3[-8:]
|
290 |
|
291 |
combined_content=response.content
|
292 |
|
|
|
327 |
{content_data}
|
328 |
"""
|
329 |
message = HumanMessage(content=augmented_prompt)
|
330 |
+
messages4.append(message)
|
331 |
+
response = chat_model.invoke(messages4)
|
332 |
+
messages4.append(AIMessage(content=response.content))
|
333 |
|
334 |
+
if len(messages4) >= 1:
|
335 |
+
messages4 = messages4[-1:]
|
336 |
|
337 |
response_message = response.content
|
338 |
|
|
|
383 |
{content_data}
|
384 |
"""
|
385 |
message = HumanMessage(content=augmented_prompt)
|
386 |
+
messages5.append(message)
|
387 |
+
response = chat_model.invoke(messages5)
|
388 |
+
messages5.append(AIMessage(content=response.content))
|
389 |
|
390 |
+
if len(messages5) >= 1:
|
391 |
+
messages5 = messages5[-1:]
|
392 |
|
393 |
response_message = response.content
|
394 |
|