Fix AI processor cache initialization issue and create empty cache file

This commit is contained in:
Jarian Cottingham 2026-02-02 09:47:35 -06:00
parent 6ce68a9037
commit e9c66da456
2 changed files with 21 additions and 2 deletions

View File

@ -25,10 +25,24 @@ class CacheManager:
if os.path.exists(self.cache_file): if os.path.exists(self.cache_file):
with open(self.cache_file, 'r', encoding='utf-8') as f: with open(self.cache_file, 'r', encoding='utf-8') as f:
return json.load(f) return json.load(f)
return {} else:
# Create empty cache file if it doesn't exist
cache_data = {
"cache_version": "1.0",
"created": datetime.now().isoformat(),
"processed_files": {}
}
self.cache = cache_data
self._save_cache()
return cache_data
except Exception as e: except Exception as e:
logger.error(f"Error loading cache file {self.cache_file}: {e}") logger.error(f"Error loading cache file {self.cache_file}: {e}")
return {} # Return empty cache on error
return {
"cache_version": "1.0",
"created": datetime.now().isoformat(),
"processed_files": {}
}
def _save_cache(self) -> None: def _save_cache(self) -> None:
"""Save cache to file.""" """Save cache to file."""

View File

@ -0,0 +1,5 @@
{
"cache_version": "1.0",
"created": "2026-02-02T15:43:08.000Z",
"processed_files": {}
}