feat: add --use-existing-index option to google_history_reader_leann.py

- Allow using existing index without rebuilding
- Useful for testing pre-built indices
This commit is contained in:
Andy Lee
2025-07-28 00:36:57 -07:00
parent 2047a1a128
commit 41812c7d22

View File

@@ -298,6 +298,11 @@ async def main():
choices=["sentence-transformers", "openai", "mlx"], choices=["sentence-transformers", "openai", "mlx"],
help="The embedding backend mode", help="The embedding backend mode",
) )
parser.add_argument(
"--use-existing-index",
action="store_true",
help="Use existing index without rebuilding",
)
args = parser.parse_args() args = parser.parse_args()
@@ -308,6 +313,14 @@ async def main():
print(f"Index directory: {INDEX_DIR}") print(f"Index directory: {INDEX_DIR}")
print(f"Max entries: {args.max_entries}") print(f"Max entries: {args.max_entries}")
if args.use_existing_index:
# Use existing index without rebuilding
if not Path(INDEX_PATH).exists():
print(f"Error: Index file not found at {INDEX_PATH}")
return
print(f"Using existing index at {INDEX_PATH}")
index_path = INDEX_PATH
else:
# Find Chrome profile directories # Find Chrome profile directories
from history_data.history import ChromeHistoryReader from history_data.history import ChromeHistoryReader