Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix: Handle divide by zero error when original size is 0 (#290)

Taranjeet Singhe8b3d53faf42
diff --git a/embedchain/loaders/web_page.py b/embedchain/loaders/web_page.py
index f6a0e66dc..cb3ba1819 100644
--- a/embedchain/loaders/web_page.py
+++ b/embedchain/loaders/web_page.py
@@ -52,9 +52,10 @@ class WebPageLoader:
content = clean_string(content)
cleaned_size = len(content)
- logging.info(
- f"[{url}] Cleaned page size: {cleaned_size} characters, down from {original_size} (shrunk: {original_size-cleaned_size} chars, {round((1-(cleaned_size/original_size)) * 100, 2)}%)" # noqa:E501
- )
+ if original_size != 0:
+ logging.info(
+ f"[{url}] Cleaned page size: {cleaned_size} characters, down from {original_size} (shrunk: {original_size-cleaned_size} chars, {round((1-(cleaned_size/original_size)) * 100, 2)}%)" # noqa:E501
+ )
meta_data = {
"url": url,