fixed sorting: it was not taking the version into consideration

This commit is contained in:
Elias Bachaalany 2023-12-19 08:32:24 -08:00
parent aad2c66b97
commit 994cc65a1e

View file

@ -116,7 +116,12 @@ def rebuild_toc(toc_out: str = '') -> Tuple[bool, str]:
print(f"[!] {gpt}") print(f"[!] {gpt}")
# Consistently sort the GPTs by ID and GPTs title # Consistently sort the GPTs by ID and GPTs title
gpts.sort(key=lambda x: (x[0].id, x[1].get('title'))) def gpts_sorter(key):
gpt_id, gpt = key
version = f"{gpt.get('version')}" if gpt.get('version') else ''
return f"{gpt.get('title')}{version} (id: {gpt_id.id}))"
gpts.sort(key=gpts_sorter)
for id, gpt in gpts: for id, gpt in gpts:
file_link = f"./prompts/gpts/{quote(os.path.basename(gpt.filename))}" file_link = f"./prompts/gpts/{quote(os.path.basename(gpt.filename))}"
version = f" {gpt.get('version')}" if gpt.get('version') else '' version = f" {gpt.get('version')}" if gpt.get('version') else ''