You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The conversation does not support concurrency. When uploading a file in the dialog box and the file is being vectorized, it is impossible to have a conversation in another window because the main thread is blocked. How can this problem be solved?
if chat_mode == "A":
await view_pdf(message.elements)
files = []
file_names = []
for element in message.elements:
if isinstance(element, cl.File) or isinstance(element, cl.Image):
files.append(element.path)
file_names.append(element.name)
m = cl.user_session.get("settings", False)
multimodal = m.get('multimodal', False)
if multimodal and len(files) > 0: rag = TraditionalRAG(files=files, file_names=file_names, ocr_enabled=multimodal)
index = await rag.create_index_local()
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT, similarity_top_k=6)
cl.user_session.set("chat_engine", chat_engine)
elif len(files) > 0:
rag = TraditionalRAG(files=files, file_names=file_names, ocr_enabled=False)
index = await rag.create_index_local()
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT, similarity_top_k=6)
cl.user_session.set("chat_engine", chat_engine)
chat_engine = cl.user_session.get("chat_engine")
res = await cl.make_async(chat_engine.stream_chat)(message.content)
for token in res.response_gen:
await msg.stream_token(token)
await msg.send()
The text was updated successfully, but these errors were encountered:
The conversation does not support concurrency. When uploading a file in the dialog box and the file is being vectorized, it is impossible to have a conversation in another window because the main thread is blocked. How can this problem be solved?
@cl.on_message
async def main(message: cl.Message):
msg = cl.Message(content="", author="Assistant")
chat_mode = cl.user_session.get("chat_profile", "A")
history = cl.user_session.get("history", [])
if chat_mode == "A":
await view_pdf(message.elements)
files = []
file_names = []
for element in message.elements:
if isinstance(element, cl.File) or isinstance(element, cl.Image):
files.append(element.path)
file_names.append(element.name)
m = cl.user_session.get("settings", False)
multimodal = m.get('multimodal', False)
if multimodal and len(files) > 0:
rag = TraditionalRAG(files=files, file_names=file_names, ocr_enabled=multimodal)
index = await rag.create_index_local()
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT, similarity_top_k=6)
cl.user_session.set("chat_engine", chat_engine)
elif len(files) > 0:
rag = TraditionalRAG(files=files, file_names=file_names, ocr_enabled=False)
index = await rag.create_index_local()
chat_engine = index.as_chat_engine(chat_mode=ChatMode.CONTEXT, similarity_top_k=6)
cl.user_session.set("chat_engine", chat_engine)
The text was updated successfully, but these errors were encountered: