Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4d5eee89d | ||
|
|
fa4d87ee77 | ||
|
|
3cb5a41cc8 | ||
|
|
16a325b798 | ||
|
|
e3171940fb |
+11
-19
@@ -235,16 +235,7 @@ class Downloader:
|
|||||||
|
|
||||||
def _check_new_csv_from_hf_dataset(self, dataset_meta: dict, now_utc: datetime, force_check: bool = False):
|
def _check_new_csv_from_hf_dataset(self, dataset_meta: dict, now_utc: datetime, force_check: bool = False):
|
||||||
"""Checks HuggingFace for file updates and updates metadata."""
|
"""Checks HuggingFace for file updates and updates metadata."""
|
||||||
perform_hf_check = True
|
perform_hf_check = force_check
|
||||||
if not force_check and dataset_meta.get("last_remote_check_timestamp"):
|
|
||||||
try:
|
|
||||||
last_check_dt = datetime.fromisoformat(dataset_meta["last_remote_check_timestamp"])
|
|
||||||
if now_utc - last_check_dt < timedelta(days=7):
|
|
||||||
perform_hf_check = False
|
|
||||||
except (ValueError, KeyError, TypeError):
|
|
||||||
print(
|
|
||||||
"[Autocomplete-Plus] Invalid or missing timestamp for last_remote_check_timestamp. Will perform remote check."
|
|
||||||
)
|
|
||||||
|
|
||||||
if perform_hf_check:
|
if perform_hf_check:
|
||||||
huggingface_dataset_id = dataset_meta["hf_dataset_id"]
|
huggingface_dataset_id = dataset_meta["hf_dataset_id"]
|
||||||
@@ -303,15 +294,16 @@ class Downloader:
|
|||||||
return f"File {file_name} is missing or empty locally."
|
return f"File {file_name} is missing or empty locally."
|
||||||
|
|
||||||
# Check if the last modified date on HuggingFace is newer than the last download date
|
# Check if the last modified date on HuggingFace is newer than the last download date
|
||||||
try:
|
# Temporarily comment out until changes to remote files can be detected
|
||||||
last_download_dt = datetime.fromisoformat(file_meta_entry["last_download"])
|
# try:
|
||||||
hf_modified_dt = datetime.fromisoformat(file_meta_entry["last_modified_on_hf"])
|
# last_download_dt = datetime.fromisoformat(file_meta_entry["last_download"])
|
||||||
if hf_modified_dt > last_download_dt:
|
# hf_modified_dt = datetime.fromisoformat(file_meta_entry["last_modified_on_hf"])
|
||||||
return f"Remote file {file_name} is newer (HF: {last_download_dt}, Local Download: {hf_modified_dt})."
|
# if hf_modified_dt > last_download_dt:
|
||||||
except (ValueError, TypeError):
|
# return f"Remote file {file_name} is newer (HF: {hf_modified_dt}, Local Download: {last_download_dt})."
|
||||||
file_meta_entry["last_download"] = None
|
# except (ValueError, TypeError):
|
||||||
file_meta_entry["last_modified_on_hf"] = None
|
# file_meta_entry["last_download"] = None
|
||||||
return f"Invalid timestamp format for {file_name}. Forcing download to ensure integrity."
|
# file_meta_entry["last_modified_on_hf"] = None
|
||||||
|
# return f"Invalid timestamp format for {file_name}. Forcing download to ensure integrity."
|
||||||
|
|
||||||
# If the file is missing or empty, but the last download timestamp exists, we need to retry.
|
# If the file is missing or empty, but the last download timestamp exists, we need to retry.
|
||||||
if not check_file_valid(local_file_path) and file_meta_entry.get("last_download") is not None:
|
if not check_file_valid(local_file_path) and file_meta_entry.get("last_download") is not None:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "comfyui-autocomplete-plus"
|
name = "comfyui-autocomplete-plus"
|
||||||
description = "Autocomplete and Related Tag display for ComfyUI"
|
description = "Autocomplete and Related Tag display for ComfyUI"
|
||||||
version = "1.4.0"
|
version = "1.4.1"
|
||||||
license = {file = "LICENSE"}
|
license = {file = "LICENSE"}
|
||||||
dependencies = ["",]
|
dependencies = ["",]
|
||||||
|
|
||||||
|
|||||||
+33
-32
@@ -190,40 +190,41 @@ async function addExtraSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add extra setting for checking new CSV updates
|
// Add extra setting for checking new CSV updates
|
||||||
app.ui.settings.addSetting({
|
// Note: Temporarily comment out until changes to remote files can be detected
|
||||||
id: id + ".check_new_csv",
|
// app.ui.settings.addSetting({
|
||||||
defaultValue: null,
|
// id: id + ".check_new_csv",
|
||||||
name: "Check CSV updates",
|
// defaultValue: null,
|
||||||
category: [name, "Misc", "Check new CSV"],
|
// name: "Check CSV updates",
|
||||||
type: () => {
|
// category: [name, "Misc", "Check new CSV"],
|
||||||
const lastCheckSpan = $el("span", {
|
// type: () => {
|
||||||
textContent: lastCheckTimeText,
|
// const lastCheckSpan = $el("span", {
|
||||||
className: "text-sm text-gray-500",
|
// textContent: lastCheckTimeText,
|
||||||
style: {
|
// className: "text-sm text-gray-500",
|
||||||
marginRight: "16px"
|
// style: {
|
||||||
}
|
// marginRight: "16px"
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
const checkButton = $el("button", {
|
// const checkButton = $el("button", {
|
||||||
textContent: "Check now",
|
// textContent: "Check now",
|
||||||
className: "p-button p-component p-button-primary",
|
// className: "p-button p-component p-button-primary",
|
||||||
onclick: async () => {
|
// onclick: async () => {
|
||||||
await performUpdateCheck(checkButton, lastCheckSpan);
|
// await performUpdateCheck(checkButton, lastCheckSpan);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
return $el("div", {
|
// return $el("div", {
|
||||||
className: "flex-row items-center gap-2",
|
// className: "flex-row items-center gap-2",
|
||||||
}, [
|
// }, [
|
||||||
$el("div", {
|
// $el("div", {
|
||||||
className: "p-component",
|
// className: "p-component",
|
||||||
}, [
|
// }, [
|
||||||
lastCheckSpan,
|
// lastCheckSpan,
|
||||||
checkButton,
|
// checkButton,
|
||||||
]),
|
// ]),
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user