from threading import Thread from .blocking import start_workers from .main import main_background_thread from .moderator import start_moderation_workers from .printer import console_printer from .recent import recent_prompters_thread from .threads import cache_stats from .. import opts def start_background(): start_workers(opts.concurrent_gens) t = Thread(target=main_background_thread) t.daemon = True t.start() print('Started the main background thread.') start_moderation_workers(opts.openai_moderation_workers) t = Thread(target=cache_stats) t.daemon = True t.start() print('Started the stats cacher.') t = Thread(target=recent_prompters_thread) t.daemon = True t.start() print('Started the recent proompters thread.') t = Thread(target=console_printer) t.daemon = True t.start() print('Started the console printer.')