mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
fix: change default chromadb storage to project-local directory
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
|
"""Path management utilities for CrewAI storage and configuration."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import appdirs
|
|
||||||
|
|
||||||
"""Path management utilities for CrewAI storage and configuration."""
|
|
||||||
|
|
||||||
def db_storage_path() -> str:
|
def db_storage_path() -> str:
|
||||||
"""Returns the path for SQLite database storage.
|
"""Returns the path for SQLite database storage.
|
||||||
@@ -11,21 +10,22 @@ def db_storage_path() -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Full path to the SQLite database file
|
str: Full path to the SQLite database file
|
||||||
"""
|
"""
|
||||||
app_name = get_project_directory_name()
|
storage_dir = os.environ.get("CREWAI_STORAGE_DIR")
|
||||||
app_author = "CrewAI"
|
|
||||||
|
if storage_dir:
|
||||||
|
data_dir = Path(storage_dir)
|
||||||
|
else:
|
||||||
|
data_dir = Path.cwd() / ".db"
|
||||||
|
|
||||||
data_dir = Path(appdirs.user_data_dir(app_name, app_author))
|
|
||||||
data_dir.mkdir(parents=True, exist_ok=True)
|
data_dir.mkdir(parents=True, exist_ok=True)
|
||||||
return str(data_dir)
|
return str(data_dir)
|
||||||
|
|
||||||
|
|
||||||
def get_project_directory_name():
|
def get_project_directory_name() -> str:
|
||||||
"""Returns the current project directory name."""
|
"""Returns the current project directory name."""
|
||||||
project_directory_name = os.environ.get("CREWAI_STORAGE_DIR")
|
project_directory_name = os.environ.get("CREWAI_STORAGE_DIR")
|
||||||
|
|
||||||
if project_directory_name:
|
if project_directory_name:
|
||||||
return project_directory_name
|
return project_directory_name
|
||||||
else:
|
cwd = Path.cwd()
|
||||||
cwd = Path.cwd()
|
return cwd.name
|
||||||
project_directory_name = cwd.name
|
|
||||||
return project_directory_name
|
|
||||||
|
|||||||
Reference in New Issue
Block a user