Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure UI feedback message for batch processing completion #170

17 changes: 14 additions & 3 deletions app/src/chainlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,25 @@ async def _batch_proccessing(file: AskFileResponse) -> None:
# E.g., "abcd.csv" to "abcd_results.csv"
result_file_name = file.name.removesuffix(".csv") + "_results.csv"

elements = [cl.File(name=result_file_name, path=result_file_path)]
await cl.Message(
author="backend",
fg-nava marked this conversation as resolved.
Show resolved Hide resolved
content="File processed, results attached.",
elements=[cl.File(name=result_file_name, path=result_file_path)],
fg-nava marked this conversation as resolved.
Show resolved Hide resolved
metadata={
"status": "processing_complete",
"original_file": file.name,
"result_file": result_file_name
},
elements=elements
).send()

except ValueError as err:
await cl.Message(
author="backend",
metadata={"error_class": err.__class__.__name__, "error": str(err)},
content=f"{err.__class__.__name__}: {err}",
content=f"Error processing file: {err}",
fg-nava marked this conversation as resolved.
Show resolved Hide resolved
metadata={
"status": "processing_error",
fg-nava marked this conversation as resolved.
Show resolved Hide resolved
"error_class": err.__class__.__name__,
"error": str(err)
}
).send()
Loading