mirror of
https://github.com/LouisShark/chatgpt_system_prompt.git
synced 2025-07-05 14:20:33 -04:00
Update idxtool.py
fixed rename count
This commit is contained in:
parent
5faa355643
commit
0e3570af9a
1 changed files with 3 additions and 4 deletions
|
@ -21,8 +21,7 @@ def get_toc_file() -> str:
|
||||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', TOC_FILENAME))
|
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', TOC_FILENAME))
|
||||||
|
|
||||||
def rename_gpts():
|
def rename_gpts():
|
||||||
nb_ok = nb_total = 0
|
effective_rename = nb_ok = nb_total = 0
|
||||||
all_renamed_already = True
|
|
||||||
|
|
||||||
for ok, gpt in enum_gpts():
|
for ok, gpt in enum_gpts():
|
||||||
nb_total += 1
|
nb_total += 1
|
||||||
|
@ -34,7 +33,7 @@ def rename_gpts():
|
||||||
if basename.startswith(f"{id.id}_"):
|
if basename.startswith(f"{id.id}_"):
|
||||||
nb_ok += 1
|
nb_ok += 1
|
||||||
continue
|
continue
|
||||||
all_renamed_already = False
|
effective_rename += 1
|
||||||
|
|
||||||
# New full file name with ID prefix
|
# New full file name with ID prefix
|
||||||
new_fn = os.path.join(os.path.dirname(gpt.filename), f"{id.id}_{basename}")
|
new_fn = os.path.join(os.path.dirname(gpt.filename), f"{id.id}_{basename}")
|
||||||
|
@ -53,7 +52,7 @@ def rename_gpts():
|
||||||
|
|
||||||
msg = f"Renamed {nb_ok} out of {nb_total} GPT files."
|
msg = f"Renamed {nb_ok} out of {nb_total} GPT files."
|
||||||
ok = nb_ok == nb_total
|
ok = nb_ok == nb_total
|
||||||
if all_renamed_already:
|
if effective_rename == 0:
|
||||||
msg = f"All {nb_total} GPT files were already renamed. No action taken."
|
msg = f"All {nb_total} GPT files were already renamed. No action taken."
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue