Spaces:
Sleeping
Sleeping
EMMA commited on
Commit ·
7e8bf6e
1
Parent(s): fa788b0
update code
Browse files
memory_bank/build_memory_index.py
CHANGED
|
@@ -32,7 +32,9 @@ index_set = {}
|
|
| 32 |
# پیکربندی دایرکتوریها بر اساس ساختار استاندارد درخواستی
|
| 33 |
CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 34 |
BASE_DIR = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, ".."))
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
INDEX_BASE_DIR = os.path.join(MEMORIES_DIR, "memory_index")
|
| 37 |
|
| 38 |
# تنظیم مسیر دقیق برای llamaindex
|
|
|
|
| 32 |
# پیکربندی دایرکتوریها بر اساس ساختار استاندارد درخواستی
|
| 33 |
CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 34 |
BASE_DIR = os.path.abspath(os.path.join(CURRENT_SCRIPT_DIR, ".."))
|
| 35 |
+
|
| 36 |
+
# <--- تغییر در اینجا: نام پوشه به Emma-memory-storage تغییر یافت --->
|
| 37 |
+
MEMORIES_DIR = os.path.join(BASE_DIR, "Emma-memory-storage")
|
| 38 |
INDEX_BASE_DIR = os.path.join(MEMORIES_DIR, "memory_index")
|
| 39 |
|
| 40 |
# تنظیم مسیر دقیق برای llamaindex
|
memory_bank/summarize_memory.py
CHANGED
|
@@ -327,7 +327,7 @@ def extract_semantic_memory(latest_episodic_memory, existing_semantic_memory):
|
|
| 327 |
updated_semantic_memory.get("behavioral_patterns", []) + new_semantic_data.get("behavioral_patterns", [])
|
| 328 |
))
|
| 329 |
|
| 330 |
-
|
| 331 |
updated_semantic_memory["recurring_themes"] = list(set(
|
| 332 |
updated_semantic_memory.get("recurring_themes", []) + new_semantic_data.get("recurring_themes", [])
|
| 333 |
))
|
|
@@ -335,10 +335,10 @@ def extract_semantic_memory(latest_episodic_memory, existing_semantic_memory):
|
|
| 335 |
print("\n✅ Semantic memory updated successfully!")
|
| 336 |
return updated_semantic_memory
|
| 337 |
|
| 338 |
-
|
| 339 |
updated_semantic_memory = existing_semantic_memory if isinstance(existing_semantic_memory, dict) else {}
|
| 340 |
|
| 341 |
-
|
| 342 |
for trait, value in new_semantic_data.get("personality_traits", {}).items():
|
| 343 |
try:
|
| 344 |
val_float = float(value)
|
|
@@ -370,7 +370,7 @@ def extract_semantic_memory(latest_episodic_memory, existing_semantic_memory):
|
|
| 370 |
return updated_semantic_memory
|
| 371 |
|
| 372 |
|
| 373 |
-
|
| 374 |
|
| 375 |
def summarize_memory(memory_dir, name=None, language='en'):
|
| 376 |
boot_name = 'AI'
|
|
|
|
| 327 |
updated_semantic_memory.get("behavioral_patterns", []) + new_semantic_data.get("behavioral_patterns", [])
|
| 328 |
))
|
| 329 |
|
| 330 |
+
|
| 331 |
updated_semantic_memory["recurring_themes"] = list(set(
|
| 332 |
updated_semantic_memory.get("recurring_themes", []) + new_semantic_data.get("recurring_themes", [])
|
| 333 |
))
|
|
|
|
| 335 |
print("\n✅ Semantic memory updated successfully!")
|
| 336 |
return updated_semantic_memory
|
| 337 |
|
| 338 |
+
|
| 339 |
updated_semantic_memory = existing_semantic_memory if isinstance(existing_semantic_memory, dict) else {}
|
| 340 |
|
| 341 |
+
|
| 342 |
for trait, value in new_semantic_data.get("personality_traits", {}).items():
|
| 343 |
try:
|
| 344 |
val_float = float(value)
|
|
|
|
| 370 |
return updated_semantic_memory
|
| 371 |
|
| 372 |
|
| 373 |
+
|
| 374 |
|
| 375 |
def summarize_memory(memory_dir, name=None, language='en'):
|
| 376 |
boot_name = 'AI'
|