Merge branch 'feat/new-login' into test/new-login-testing
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions

* feat/new-login:
  chore: remove extra config and init login type
This commit is contained in:
Joe 2024-10-17 17:53:17 +08:00
commit 7b91d6868c
3 changed files with 4 additions and 36 deletions

View File

@ -20,11 +20,11 @@ class SecurityConfig(BaseSettings):
Security-related configurations for the application
"""
SECRET_KEY: str = Field(
SECRET_KEY: Optional[str] = Field(
description="Secret key for secure session cookie signing."
"Make sure you are changing this key for your deployment with a strong key."
"Generate a strong key using `openssl rand -base64 42` or set via the `SECRET_KEY` environment variable.",
default="",
default=None,
)
RESET_PASSWORD_TOKEN_EXPIRY_HOURS: PositiveInt = Field(
@ -186,16 +186,6 @@ class FileUploadConfig(BaseSettings):
default=10,
)
UPLOAD_VIDEO_FILE_SIZE_LIMIT: NonNegativeInt = Field(
description="video file size limit in Megabytes for uploading files",
default=100,
)
UPLOAD_AUDIO_FILE_SIZE_LIMIT: NonNegativeInt = Field(
description="audio file size limit in Megabytes for uploading files",
default=50,
)
BATCH_UPLOAD_LIMIT: NonNegativeInt = Field(
description="Maximum number of files allowed in a batch upload operation",
default=20,
@ -503,7 +493,6 @@ class RagEtlConfig(BaseSettings):
Configuration for RAG ETL processes
"""
# TODO: This config is not only for rag etl, it is also for file upload, we should move it to file upload config
ETL_TYPE: str = Field(
description="RAG ETL type ('dify' or 'Unstructured'), default to 'dify'",
default="dify",
@ -546,11 +535,6 @@ class DataSetConfig(BaseSettings):
default=False,
)
TIDB_SERVERLESS_NUMBER: PositiveInt = Field(
description="number of tidb serverless cluster",
default=500,
)
class WorkspaceConfig(BaseSettings):
"""
@ -575,7 +559,7 @@ class IndexingConfig(BaseSettings):
class ImageFormatConfig(BaseSettings):
MULTIMODAL_SEND_IMAGE_FORMAT: Literal["base64", "url"] = Field(
MULTIMODAL_SEND_IMAGE_FORMAT: str = Field(
description="Format for sending images in multimodal contexts ('base64' or 'url'), default is base64",
default="base64",
)
@ -670,9 +654,6 @@ class LoginConfig(BaseSettings):
default=False,
)
class Config:
frozen = False
class FeatureConfig(
# place the configs in alphabet order

View File

@ -32,7 +32,6 @@ from models.account import (
TenantStatus,
)
from models.model import DifySetup
from services.enterprise.enterprise_service import EnterpriseService
from services.errors.account import (
AccountAlreadyInTenantError,
AccountLoginError,
@ -953,14 +952,4 @@ class RegisterService:
def _generate_refresh_token(length: int = 64):
token = secrets.token_hex(length)
return token
class InitLoginType:
@staticmethod
def init_login_type():
enterprise_info = EnterpriseService.get_info()
dify_config.ENABLE_EMAIL_CODE_LOGIN = enterprise_info["enable_email_code_login"]
dify_config.ENABLE_EMAIL_PASSWORD_LOGIN = enterprise_info["enable_email_password_login"]
dify_config.ALLOW_REGISTER = enterprise_info["is_allow_register"]
dify_config.ALLOW_CREATE_WORKSPACE = enterprise_info["is_allow_create_workspace"]
return token

View File

@ -1,7 +1,6 @@
from pydantic import BaseModel, ConfigDict
from configs import dify_config
from services.account_service import InitLoginType
from services.billing_service import BillingService
from services.enterprise.enterprise_service import EnterpriseService
@ -127,7 +126,6 @@ class FeatureService:
@classmethod
def _fulfill_params_from_enterprise(cls, features):
InitLoginType.init_login_type()
enterprise_info = EnterpriseService.get_info()
features.sso_enforced_for_signin = enterprise_info["sso_enforced_for_signin"]