fix _update_browse_history_setup (#345)

This commit is contained in:
Yanxiao Zhao
2025-09-25 13:22:40 +08:00
committed by GitHub
parent a4f8fe2f00
commit 6827949418

View File

@@ -813,7 +813,7 @@ class SetupController:
def _update_browse_history_setup(self, **config): def _update_browse_history_setup(self, **config):
cache_path = os.path.join(self.cache_dir, "history_new.sqlite") cache_path = os.path.join(self.cache_dir, "history_new.sqlite")
db_url = "https://drive.usercontent.google.com/u/0/uc?id=1Lv74QkJYDWVX0RIgg0Co-DUcoYpVL0oX&export=download" # google drive db_url = "https://huggingface.co/datasets/xlangai/ubuntu_osworld_file_cache/resolve/main/chrome/44ee5668-ecd5-4366-a6ce-c1c9b8d4e938/history_empty.sqlite?download=true"
if not os.path.exists(cache_path): if not os.path.exists(cache_path):
max_retries = 3 max_retries = 3
downloaded = False downloaded = False
@@ -839,7 +839,9 @@ class SetupController:
else: else:
logger.info("File already exists in cache directory") logger.info("File already exists in cache directory")
# copy a new history file in the tmp folder # copy a new history file in the tmp folder
db_path = cache_path with tempfile.TemporaryDirectory() as tmp_dir:
db_path = os.path.join(tmp_dir, "history_empty.sqlite")
shutil.copy(cache_path, db_path)
history = config['history'] history = config['history']