Autosave generated text in the Notebook tab (#7079)

This commit is contained in:
oobabooga 2025-06-16 17:36:05 -03:00 committed by GitHub
parent d0befe0729
commit faae4dc1b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 325 additions and 52 deletions

View file

@ -159,10 +159,12 @@ def get_available_presets():
def get_available_prompts():
prompt_files = list(Path('user_data/prompts').glob('*.txt'))
notebook_dir = Path('user_data/logs/notebook')
notebook_dir.mkdir(parents=True, exist_ok=True)
prompt_files = list(notebook_dir.glob('*.txt'))
sorted_files = sorted(prompt_files, key=lambda x: x.stat().st_mtime, reverse=True)
prompts = [file.stem for file in sorted_files]
prompts.append('None')
return prompts