Update app.py
Browse files
app.py
CHANGED
@@ -193,11 +193,13 @@ def user3(user_message, history, file_path):
|
|
193 |
combined_message = f"{file_path}\n{user_message}"
|
194 |
return "", history + [[combined_message, None]], file_path
|
195 |
|
|
|
|
|
|
|
|
|
|
|
196 |
def Chat_Message(history):
|
197 |
-
messages
|
198 |
-
SystemMessage(content="You are a helpful assistant."),
|
199 |
-
HumanMessage(content="Hi AI, how are you today?"),
|
200 |
-
AIMessage(content="I'm great thank you. How can I help you?")]
|
201 |
|
202 |
message=HumanMessage(content=history[-1][0])
|
203 |
messages.append(message)
|
@@ -214,10 +216,7 @@ def Chat_Message(history):
|
|
214 |
yield history
|
215 |
|
216 |
def Web_Search(history):
|
217 |
-
messages
|
218 |
-
SystemMessage(content="You are a helpful assistant."),
|
219 |
-
HumanMessage(content="Hi AI, how are you today?"),
|
220 |
-
AIMessage(content="I'm great thank you. How can I help you?")]
|
221 |
|
222 |
message=history[-1][0]
|
223 |
|
@@ -250,11 +249,7 @@ def Web_Search(history):
|
|
250 |
yield history
|
251 |
|
252 |
def Chart_Generator(history):
|
253 |
-
messages
|
254 |
-
SystemMessage(content="You are a helpful assistant."),
|
255 |
-
HumanMessage(content="Hi AI, how are you today?"),
|
256 |
-
AIMessage(content="I'm great thank you. How can I help you?")
|
257 |
-
]
|
258 |
|
259 |
message = history[-1][0]
|
260 |
if '#chart' in message:
|
@@ -298,11 +293,7 @@ def Chart_Generator(history):
|
|
298 |
yield history
|
299 |
|
300 |
def Link_Scratch(history):
|
301 |
-
messages
|
302 |
-
SystemMessage(content="You are a helpful assistant."),
|
303 |
-
HumanMessage(content="Hi AI, how are you today?"),
|
304 |
-
AIMessage(content="I'm great thank you. How can I help you?")
|
305 |
-
]
|
306 |
|
307 |
combined_message = history[-1][0]
|
308 |
|
@@ -362,10 +353,7 @@ def display_file_name(file):
|
|
362 |
raise gr.Error("( Supported File Types Only : PDF , CSV , TXT , DOCX , PPTX , XLSX , JSON , HTML , XML )")
|
363 |
|
364 |
def File_Interact(history,filepath):
|
365 |
-
messages
|
366 |
-
SystemMessage(content="You are a helpful assistant."),
|
367 |
-
HumanMessage(content="Hi AI, how are you today?"),
|
368 |
-
AIMessage(content="I'm great thank you. How can I help you?")]
|
369 |
|
370 |
combined_message = history[-1][0]
|
371 |
|
|
|
193 |
combined_message = f"{file_path}\n{user_message}"
|
194 |
return "", history + [[combined_message, None]], file_path
|
195 |
|
196 |
+
messages = [
|
197 |
+
SystemMessage(content="You are a helpful assistant."),
|
198 |
+
HumanMessage(content="Hi AI, how are you today?"),
|
199 |
+
AIMessage(content="I'm great thank you. How can I help you?")]
|
200 |
+
|
201 |
def Chat_Message(history):
|
202 |
+
global messages
|
|
|
|
|
|
|
203 |
|
204 |
message=HumanMessage(content=history[-1][0])
|
205 |
messages.append(message)
|
|
|
216 |
yield history
|
217 |
|
218 |
def Web_Search(history):
|
219 |
+
global messages
|
|
|
|
|
|
|
220 |
|
221 |
message=history[-1][0]
|
222 |
|
|
|
249 |
yield history
|
250 |
|
251 |
def Chart_Generator(history):
|
252 |
+
global messages
|
|
|
|
|
|
|
|
|
253 |
|
254 |
message = history[-1][0]
|
255 |
if '#chart' in message:
|
|
|
293 |
yield history
|
294 |
|
295 |
def Link_Scratch(history):
|
296 |
+
global messages
|
|
|
|
|
|
|
|
|
297 |
|
298 |
combined_message = history[-1][0]
|
299 |
|
|
|
353 |
raise gr.Error("( Supported File Types Only : PDF , CSV , TXT , DOCX , PPTX , XLSX , JSON , HTML , XML )")
|
354 |
|
355 |
def File_Interact(history,filepath):
|
356 |
+
global messages
|
|
|
|
|
|
|
357 |
|
358 |
combined_message = history[-1][0]
|
359 |
|