浏览代码

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

tags/0.6.13
-LAN- 1年前
父节点
当前提交
32d85fb896
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 3
    0
      api/configs/app_config.py
  2. 1
    1
      api/configs/feature/__init__.py
  3. 1
    1
      api/configs/middleware/__init__.py

+ 3
- 0
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,

+ 1
- 1
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='*',

+ 1
- 1
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


正在加载...
取消
保存