mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
class Singleton(type):
|
|
"""
|
|
Singleton metaclass for ensuring only one instance of a class.
|
|
"""
|
|
|
|
_instances = {}
|
|
|
|
def __call__(cls, *args, **kwargs):
|
|
if cls not in cls._instances:
|
|
cls._instances[cls] = super(
|
|
Singleton, cls).__call__(
|
|
*args, **kwargs)
|
|
return cls._instances[cls]
|
|
|
|
|
|
class Config(metaclass=Singleton):
|
|
"""
|
|
Configuration class to store the state of bools for different scripts access.
|
|
"""
|
|
|
|
def __init__(self):
|
|
self.continuous_mode = False
|
|
self.speak_mode = False
|
|
self.fast_llm_model = "gpt-3.5-turbo"
|
|
self.smart_llm_model = "gpt-3.5-turbo"
|
|
self.thinking_token_limit = 4000
|
|
|
|
def set_continuous_mode(self, value: bool):
|
|
self.continuous_mode = value
|
|
|
|
def set_speak_mode(self, value: bool):
|
|
self.speak_mode = value
|
|
|
|
def set_fast_llm_model(self, value: str):
|
|
self.fast_llm_model = value
|
|
|
|
def set_smart_llm_model(self, value: str):
|
|
self.smart_llm_model = value
|
|
|
|
def set_thinking_token_limit(self, value: int):
|
|
self.thinking_token_limit = value
|