mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-05 10:28:06 -05:00
refac
This commit is contained in:
@@ -222,10 +222,11 @@ class PersistentConfig(Generic[T]):
|
||||
|
||||
|
||||
class AppConfig:
|
||||
_state: dict[str, PersistentConfig]
|
||||
_redis: Union[redis.Redis, redis.cluster.RedisCluster] = None
|
||||
_redis_key_prefix: str
|
||||
|
||||
_state: dict[str, PersistentConfig]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
redis_url: Optional[str] = None,
|
||||
@@ -233,9 +234,8 @@ class AppConfig:
|
||||
redis_cluster: Optional[bool] = False,
|
||||
redis_key_prefix: str = "open-webui",
|
||||
):
|
||||
super().__setattr__("_state", {})
|
||||
super().__setattr__("_redis_key_prefix", redis_key_prefix)
|
||||
if redis_url:
|
||||
super().__setattr__("_redis_key_prefix", redis_key_prefix)
|
||||
super().__setattr__(
|
||||
"_redis",
|
||||
get_redis_connection(
|
||||
@@ -246,6 +246,8 @@ class AppConfig:
|
||||
),
|
||||
)
|
||||
|
||||
super().__setattr__("_state", {})
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if isinstance(value, PersistentConfig):
|
||||
self._state[key] = value
|
||||
|
||||
Reference in New Issue
Block a user