GoodLuckChuck commited on
Commit
0432cd0
·
verified ·
1 Parent(s): a529f2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -194,6 +194,18 @@ class LocalSearch(Tool):
194
  self.knowledge_base_path = knowledge_base_path
195
  self._load_knowledge_base()
196
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  async def _execute_impl(self, input_data: Union[str, Dict[str, Any]]) -> Any:
198
  """Enhanced execution with better input handling"""
199
  try:
 
194
  self.knowledge_base_path = knowledge_base_path
195
  self._load_knowledge_base()
196
 
197
+ def _load_knowledge_base(self):
198
+ """Initialize the knowledge base directories"""
199
+ try:
200
+ # Create necessary subdirectories if they don't exist
201
+ for subdir in ['text', 'data', 'media', 'other']:
202
+ dir_path = self.knowledge_base_path / subdir
203
+ dir_path.mkdir(parents=True, exist_ok=True)
204
+ logger.info(f"Knowledge base initialized at {self.knowledge_base_path}")
205
+ except Exception as e:
206
+ logger.error(f"Error initializing knowledge base: {str(e)}")
207
+ raise
208
+
209
  async def _execute_impl(self, input_data: Union[str, Dict[str, Any]]) -> Any:
210
  """Enhanced execution with better input handling"""
211
  try: