Update app.py
Browse files
app.py
CHANGED
@@ -88,14 +88,17 @@ async def init():
|
|
88 |
|
89 |
)
|
90 |
|
91 |
-
msg.content = f"Index built! Bare spรธr ivei..๐ค\n\n{
|
92 |
await msg.send()
|
93 |
|
94 |
cl.user_session.set("chain", chain)
|
95 |
|
|
|
96 |
|
97 |
@cl.on_message
|
98 |
async def main(message):
|
|
|
|
|
99 |
chain = cl.user_session.get("chain")
|
100 |
cb = cl.AsyncLangchainCallbackHandler(
|
101 |
stream_final_answer=True,
|
@@ -107,6 +110,10 @@ async def main(message):
|
|
107 |
return
|
108 |
|
109 |
answer = res["result"]
|
|
|
|
|
|
|
|
|
110 |
source_elements = []
|
111 |
visited_sources = set()
|
112 |
|
|
|
88 |
|
89 |
)
|
90 |
|
91 |
+
msg.content = f"Index built! Bare spรธr ivei..๐ค\n\n{table}"
|
92 |
await msg.send()
|
93 |
|
94 |
cl.user_session.set("chain", chain)
|
95 |
|
96 |
+
last_response = None
|
97 |
|
98 |
@cl.on_message
|
99 |
async def main(message):
|
100 |
+
global last_response
|
101 |
+
|
102 |
chain = cl.user_session.get("chain")
|
103 |
cb = cl.AsyncLangchainCallbackHandler(
|
104 |
stream_final_answer=True,
|
|
|
110 |
return
|
111 |
|
112 |
answer = res["result"]
|
113 |
+
if answer != last_response:
|
114 |
+
await cl.Message(content=answer).send()
|
115 |
+
last_response = answer
|
116 |
+
|
117 |
source_elements = []
|
118 |
visited_sources = set()
|
119 |
|