Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,6 @@ messages = [
|
|
33 |
|
34 |
def handle_message(message: str, mode: str):
|
35 |
|
36 |
-
# Check if message is empty
|
37 |
if not message.strip():
|
38 |
return "Enter a valid message."
|
39 |
if mode == "Chat-Message":
|
@@ -63,6 +62,7 @@ def web_search(message: str):
|
|
63 |
|
64 |
global messages
|
65 |
similar_docs = db.similarity_search(message, k=3)
|
|
|
66 |
if similar_docs:
|
67 |
source_knowledge = "\n".join([x.page_content for x in similar_docs])
|
68 |
else:
|
@@ -116,4 +116,5 @@ demo = gr.Interface(
|
|
116 |
inputs=["text", gr.Radio(["Chat-Message", "Web-Search", "Chart-Generator"], label="mode", info="Choose a mode and enter your message, then click submit to interact.")],
|
117 |
outputs="text",
|
118 |
title="IT Assistant")
|
|
|
119 |
demo.launch()
|
|
|
33 |
|
34 |
def handle_message(message: str, mode: str):
|
35 |
|
|
|
36 |
if not message.strip():
|
37 |
return "Enter a valid message."
|
38 |
if mode == "Chat-Message":
|
|
|
62 |
|
63 |
global messages
|
64 |
similar_docs = db.similarity_search(message, k=3)
|
65 |
+
|
66 |
if similar_docs:
|
67 |
source_knowledge = "\n".join([x.page_content for x in similar_docs])
|
68 |
else:
|
|
|
116 |
inputs=["text", gr.Radio(["Chat-Message", "Web-Search", "Chart-Generator"], label="mode", info="Choose a mode and enter your message, then click submit to interact.")],
|
117 |
outputs="text",
|
118 |
title="IT Assistant")
|
119 |
+
|
120 |
demo.launch()
|