Implement sessions + add basic multi-user support (#2991)
This commit is contained in:
parent
1f8cae14f9
commit
4b1804a438
17 changed files with 595 additions and 414 deletions
|
@ -7,6 +7,14 @@ from modules import shared
|
|||
from modules.logging_colors import logger
|
||||
|
||||
|
||||
# Helper function to get multiple values from shared.gradio
|
||||
def gradio(*keys):
|
||||
if len(keys) == 1 and type(keys[0]) is list:
|
||||
keys = keys[0]
|
||||
|
||||
return [shared.gradio[k] for k in keys]
|
||||
|
||||
|
||||
def save_file(fname, contents):
|
||||
if fname == '':
|
||||
logger.error('File name is empty!')
|
||||
|
@ -111,3 +119,8 @@ def get_datasets(path: str, ext: str):
|
|||
|
||||
def get_available_chat_styles():
|
||||
return sorted(set(('-'.join(k.stem.split('-')[1:]) for k in Path('css').glob('chat_style*.css'))), key=natural_keys)
|
||||
|
||||
|
||||
def get_available_sessions():
|
||||
items = sorted(set(k.stem for k in Path('logs').glob(f'session_{shared.get_mode()}*')), key=natural_keys, reverse=True)
|
||||
return [item for item in items if 'autosave' in item] + [item for item in items if 'autosave' not in item]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue