Spaces:
Sleeping
Sleeping
EMMA commited on
Commit ·
30dc71e
1
Parent(s): 523276a
update code
Browse files
memory_bank/build_memory_index.py
CHANGED
|
@@ -29,14 +29,18 @@ from llama_index.llms.openai import OpenAI
|
|
| 29 |
# A dictionary to hold the loaded or newly created indices in memory.
|
| 30 |
index_set = {}
|
| 31 |
|
| 32 |
-
# پشتیبانی
|
| 33 |
BASE_DIR = "/data" if os.path.exists("/data") else os.path.dirname(os.path.abspath(__file__))
|
| 34 |
|
|
|
|
| 35 |
_INDEX_BASE_DIR = os.getenv(
|
| 36 |
-
"EMMA_INDEX_DIR",
|
| 37 |
-
os.path.join(BASE_DIR, "
|
| 38 |
)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
# --- Core Functions ---
|
| 42 |
|
|
|
|
| 29 |
# A dictionary to hold the loaded or newly created indices in memory.
|
| 30 |
index_set = {}
|
| 31 |
|
| 32 |
+
# پشتیبانی هوشمند از Persistent Storage در Hugging Face (/data) یا مسیر محلی
|
| 33 |
BASE_DIR = "/data" if os.path.exists("/data") else os.path.dirname(os.path.abspath(__file__))
|
| 34 |
|
| 35 |
+
# اصلاح مسیر دقیق بر اساس ساختار ریپازیتوری شما (حذف پوشه memories و پرانتز اضافه)
|
| 36 |
_INDEX_BASE_DIR = os.getenv(
|
| 37 |
+
"EMMA_INDEX_DIR",
|
| 38 |
+
os.path.join(BASE_DIR, "memory_index", "llamaindex")
|
| 39 |
)
|
| 40 |
|
| 41 |
+
# اطمینان از وجود دایرکتوری در صورت ساخت ایندکس جدید
|
| 42 |
+
os.makedirs(_INDEX_BASE_DIR, exist_ok=True)
|
| 43 |
+
|
| 44 |
|
| 45 |
# --- Core Functions ---
|
| 46 |
|