Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

chore: Update some type hints in config. (#5833)

-LAN-32d85fb89607
diff --git a/api/configs/app_config.py b/api/configs/app_config.py
index 4467b84c866..e5edc86bc3d 100644
--- a/api/configs/app_config.py
+++ b/api/configs/app_config.py
@@ -8,6 +8,9 @@ from configs.middleware import MiddlewareConfig
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(
# based on pydantic-settings
BaseSettings,
diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.py
index d8ab749560e..2205b0e169d 100644
--- a/api/configs/feature/__init__.py
+++ b/api/configs/feature/__init__.py
@@ -136,7 +136,7 @@ class HttpConfig(BaseModel):
def CONSOLE_CORS_ALLOW_ORIGINS(self) -> list[str]:
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='',
validation_alias=AliasChoices('WEB_API_CORS_ALLOW_ORIGINS'),
default='*',
diff --git a/api/configs/middleware/__init__.py b/api/configs/middleware/__init__.py
index b1957efb6b5..6b3ed1a1009 100644
--- a/api/configs/middleware/__init__.py
+++ b/api/configs/middleware/__init__.py
@@ -144,7 +144,7 @@ class CeleryConfig(DatabaseConfig):
@computed_field
@property
- def CELERY_RESULT_BACKEND(self) -> str:
+ def CELERY_RESULT_BACKEND(self) -> str | None:
return 'db+{}'.format(self.SQLALCHEMY_DATABASE_URI) \
if self.CELERY_BACKEND == 'database' else self.CELERY_BROKER_URL