From cf47865b201f8ea915d2fd2b8857b97976001772 Mon Sep 17 00:00:00 2001 From: Bowen Liang Date: Sat, 15 Jun 2024 22:47:09 +0800 Subject: [PATCH] ModerationConfigs --- api/config.py | 5 ----- api/configs/feature/__init__.py | 13 +++++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/api/config.py b/api/config.py index 505f6f3bc9e40f..c99e77f40589c9 100644 --- a/api/config.py +++ b/api/config.py @@ -42,7 +42,6 @@ 'HOSTED_FETCH_APP_TEMPLATES_MODE': 'remote', 'HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN': 'https://tmpl.dify.ai', 'CLEAN_DAY_SETTING': 30, - 'OUTPUT_MODERATION_BUFFER_SIZE': 300, 'MULTIMODAL_SEND_IMAGE_FORMAT': 'base64', 'INVITE_EXPIRY_HOURS': 72, 'ETL_TYPE': 'dify', @@ -185,7 +184,6 @@ def __init__(self): self.RELYT_PASSWORD = get_env('RELYT_PASSWORD') self.RELYT_DATABASE = get_env('RELYT_DATABASE') - # tencent settings self.TENCENT_VECTOR_DB_URL = get_env('TENCENT_VECTOR_DB_URL') self.TENCENT_VECTOR_DB_API_KEY = get_env('TENCENT_VECTOR_DB_API_KEY') @@ -266,9 +264,6 @@ def __init__(self): # Tool Configurations. self.TOOL_ICON_CACHE_MAX_AGE = get_env('TOOL_ICON_CACHE_MAX_AGE') - # Moderation in app Configurations. - self.OUTPUT_MODERATION_BUFFER_SIZE = int(get_env('OUTPUT_MODERATION_BUFFER_SIZE')) - # ------------------------ # Platform Configurations. # ------------------------ diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.py index 672eef2cb67cf8..68d89f59e53f00 100644 --- a/api/configs/feature/__init__.py +++ b/api/configs/feature/__init__.py @@ -247,8 +247,21 @@ class OAuthConfigs(BaseModel): ) +class ModerationConfigs(BaseModel): + """ + Moderation in app configs. + """ + + # todo: to be clarified in usage and unit + OUTPUT_MODERATION_BUFFER_SIZE: PositiveInt = Field( + description='buffer size for moderation', + default=300, + ) + + class FeatureConfigs( OAuthConfigs, + ModerationConfigs, EndpointConfigs, HttpConfigs, LoggingConfigs,