mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 09:06:02 +08:00
chore: Update some type hints in config. (#5833)
This commit is contained in:
parent
af308b99a3
commit
32d85fb896
@ -8,6 +8,9 @@ from configs.middleware import MiddlewareConfig
|
|||||||
from configs.packaging import PackagingInfo
|
from configs.packaging import PackagingInfo
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Both `BaseModel` and `BaseSettings` has `model_config` attribute but they are in different types.
|
||||||
|
# This inheritance is depends on the order of the classes.
|
||||||
|
# It is better to use `BaseSettings` as the base class.
|
||||||
class DifyConfig(
|
class DifyConfig(
|
||||||
# based on pydantic-settings
|
# based on pydantic-settings
|
||||||
BaseSettings,
|
BaseSettings,
|
||||||
|
@ -136,7 +136,7 @@ class HttpConfig(BaseModel):
|
|||||||
def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]:
|
def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]:
|
||||||
return self.inner_CONSOLE_CORS_ALLOW_ORIGINS.split(',')
|
return self.inner_CONSOLE_CORS_ALLOW_ORIGINS.split(',')
|
||||||
|
|
||||||
inner_WEB_API_CORS_ALLOW_ORIGINS: Optional[str] = Field(
|
inner_WEB_API_CORS_ALLOW_ORIGINS: str = Field(
|
||||||
description='',
|
description='',
|
||||||
validation_alias=AliasChoices('WEB_API_CORS_ALLOW_ORIGINS'),
|
validation_alias=AliasChoices('WEB_API_CORS_ALLOW_ORIGINS'),
|
||||||
default='*',
|
default='*',
|
||||||
|
@ -144,7 +144,7 @@ class CeleryConfig(DatabaseConfig):
|
|||||||
|
|
||||||
@computed_field
|
@computed_field
|
||||||
@property
|
@property
|
||||||
def CELERY_RESULT_BACKEND(self) -> str:
|
def CELERY_RESULT_BACKEND(self) -> str | None:
|
||||||
return 'db+{}'.format(self.SQLALCHEMY_DATABASE_URI) \
|
return 'db+{}'.format(self.SQLALCHEMY_DATABASE_URI) \
|
||||||
if self.CELERY_BACKEND == 'database' else self.CELERY_BROKER_URL
|
if self.CELERY_BACKEND == 'database' else self.CELERY_BROKER_URL
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user