Skip to content

Commit 092d03c

Browse files
Boburmirzoactions-usergithub-actions[bot]
authored
add give a star action in logs of enable (#114)
* add give a star action in logs * add memori counter * Auto-format code with Black, isort, and Ruff - Applied Black formatting (line-length: 88) - Sorted imports with isort (black profile) - Applied Ruff auto-fixes Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: GitHub Action <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 433a52e commit 092d03c

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

memori/core/memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ def _get_auto_ingest_context(self, user_input: str) -> list[dict[str, Any]]:
12131213
results[:3]
12141214
): # Log first 3 results for debugging
12151215
logger.debug(
1216-
f"Auto-ingest: Result {i+1}: {type(result)} with keys: {list(result.keys()) if isinstance(result, dict) else 'N/A'}"
1216+
f"Auto-ingest: Result {i + 1}: {type(result)} with keys: {list(result.keys()) if isinstance(result, dict) else 'N/A'}"
12171217
)
12181218
except Exception as db_search_e:
12191219
logger.error(f"Auto-ingest: Database search failed: {db_search_e}")

memori/database/mongodb_manager.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,28 @@ def mark_conscious_memories_processed(
928928
except Exception as e:
929929
logger.error(f"Failed to mark conscious memories processed: {e}")
930930

931+
def _check_milestone(self, memory_count: int):
932+
"""
933+
Check and celebrate memory storage milestones to encourage user engagement.
934+
Displays celebration messages at key milestones: 10, 50, 100, 500, 1000 memories.
935+
936+
Args:
937+
memory_count: Current count of long-term memories
938+
"""
939+
milestones = [10, 50, 100, 500, 1000]
940+
941+
if memory_count in milestones:
942+
celebration_msg = (
943+
f"\n{'=' * 60}\n"
944+
f"🎉 Milestone Achieved: {memory_count} memories stored!\n"
945+
f"{'=' * 60}\n"
946+
f"⭐️ Loving Memori? Give us a star on GitHub!\n"
947+
f"👉 https://github.com/GibsonAI/memori\n"
948+
f"Your support helps us build better open AI memory tools ❤️\n"
949+
f"{'=' * 60}\n"
950+
)
951+
logger.info(celebration_msg)
952+
931953
def store_long_term_memory_enhanced(
932954
self, memory: ProcessedLongTermMemory, chat_id: str, namespace: str = "default"
933955
) -> str:
@@ -1000,6 +1022,13 @@ def store_long_term_memory_enhanced(
10001022
collection.insert_one(document)
10011023

10021024
logger.debug(f"Stored enhanced long-term memory {memory_id}")
1025+
1026+
# Get current memory count and check for milestones
1027+
total_memories = collection.count_documents({"namespace": namespace})
1028+
1029+
# Celebrate milestone if reached
1030+
self._check_milestone(total_memories)
1031+
10031032
return memory_id
10041033

10051034
except Exception as e:

memori/database/sqlalchemy_manager.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,28 @@ def get_chat_history(
572572
except SQLAlchemyError as e:
573573
raise DatabaseError(f"Failed to get chat history: {e}")
574574

575+
def _check_milestone(self, memory_count: int):
576+
"""
577+
Check and celebrate memory storage milestones to encourage user engagement.
578+
Displays celebration messages at key milestones: 10, 50, 100, 500, 1000 memories.
579+
580+
Args:
581+
memory_count: Current count of long-term memories
582+
"""
583+
milestones = [10, 50, 100, 500, 1000]
584+
585+
if memory_count in milestones:
586+
celebration_msg = (
587+
f"\n{'=' * 60}\n"
588+
f"🎉 Milestone Achieved: {memory_count} memories stored!\n"
589+
f"{'=' * 60}\n"
590+
f"⭐️ Loving Memori? Give us a star on GitHub!\n"
591+
f"👉 https://github.com/GibsonAI/memori\n"
592+
f"Your support helps us build better open AI memory tools ❤️\n"
593+
f"{'=' * 60}\n"
594+
)
595+
logger.info(celebration_msg)
596+
575597
def store_long_term_memory_enhanced(
576598
self, memory: ProcessedLongTermMemory, chat_id: str, namespace: str = "default"
577599
) -> str:
@@ -618,6 +640,17 @@ def store_long_term_memory_enhanced(
618640
session.commit()
619641

620642
logger.debug(f"Stored enhanced long-term memory {memory_id}")
643+
644+
# Get current memory count and check for milestones
645+
total_memories = (
646+
session.query(LongTermMemory)
647+
.filter(LongTermMemory.namespace == namespace)
648+
.count()
649+
)
650+
651+
# Celebrate milestone if reached
652+
self._check_milestone(total_memories)
653+
621654
return memory_id
622655

623656
except SQLAlchemyError as e:

0 commit comments

Comments
 (0)