TalatMasood commited on
Commit
d3c044c
·
1 Parent(s): 201570a

Updating path for chroma_db

Browse files
Files changed (2) hide show
  1. config/config.py +2 -3
  2. src/main.py +11 -0
config/config.py CHANGED
@@ -65,9 +65,8 @@ class Settings:
65
  }
66
 
67
  # Vector Store Configuration
68
- # CHROMA_PATH = os.getenv('CHROMA_PATH', './chroma_db')
69
- CHROMA_PATH = os.getenv('CHROMA_PATH', os.path.join(
70
- os.path.dirname(__file__), 'data', 'chroma_db'))
71
 
72
  # Feedback Configuration
73
  MAX_RATING = int(os.getenv('MAX_RATING', '5'))
 
65
  }
66
 
67
  # Vector Store Configuration
68
+ CHROMA_PATH = os.getenv('CHROMA_PATH', './chroma_db')
69
+ # CHROMA_PATH = os.getenv('CHROMA_PATH', os.path.join(os.path.dirname(__file__), 'data', 'chroma_db'))
 
70
 
71
  # Feedback Configuration
72
  MAX_RATING = int(os.getenv('MAX_RATING', '5'))
src/main.py CHANGED
@@ -76,6 +76,17 @@ mongodb = MongoDBStore(settings.MONGODB_URI)
76
  UPLOADS_DIR = Path(settings.UPLOADS_DIR)
77
  UPLOADS_DIR.mkdir(parents=True, exist_ok=True)
78
 
 
 
 
 
 
 
 
 
 
 
 
79
  # Initialize core components
80
  doc_processor = DocumentProcessor()
81
  summarizer = ConversationSummarizer()
 
76
  UPLOADS_DIR = Path(settings.UPLOADS_DIR)
77
  UPLOADS_DIR.mkdir(parents=True, exist_ok=True)
78
 
79
+ chroma_path = Path(settings.CHROMA_PATH).resolve()
80
+ try:
81
+ chroma_path.mkdir(parents=True, exist_ok=True)
82
+ print(f"ChromaDB directory created at: {chroma_path}")
83
+ except PermissionError:
84
+ # If the original location fails, try a directory relative to the current working directory
85
+ alt_path = Path(os.getcwd()) / "data" / "chroma_db"
86
+ alt_path.mkdir(parents=True, exist_ok=True)
87
+ settings.CHROMA_PATH = str(alt_path)
88
+ print(f"Using alternative ChromaDB path: {alt_path}")
89
+
90
  # Initialize core components
91
  doc_processor = DocumentProcessor()
92
  summarizer = ConversationSummarizer()