mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 15:09:00 +08:00
fix(api/core/moderation/output_moderation.py): Fix config call. (#6769)
This commit is contained in:
parent
2cd662c43b
commit
8dd68e2034
@ -64,4 +64,6 @@ class DifyConfig(
|
|||||||
return f'{self.HTTP_REQUEST_NODE_MAX_TEXT_SIZE / 1024 / 1024:.2f}MB'
|
return f'{self.HTTP_REQUEST_NODE_MAX_TEXT_SIZE / 1024 / 1024:.2f}MB'
|
||||||
|
|
||||||
SSRF_PROXY_HTTP_URL: str | None = None
|
SSRF_PROXY_HTTP_URL: str | None = None
|
||||||
SSRF_PROXY_HTTPS_URL: str | None = None
|
SSRF_PROXY_HTTPS_URL: str | None = None
|
||||||
|
|
||||||
|
MODERATION_BUFFER_SIZE: int = Field(default=300, description='The buffer size for moderation.')
|
||||||
|
@ -21,8 +21,6 @@ class ModerationRule(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class OutputModeration(BaseModel):
|
class OutputModeration(BaseModel):
|
||||||
DEFAULT_BUFFER_SIZE: int = 300
|
|
||||||
|
|
||||||
tenant_id: str
|
tenant_id: str
|
||||||
app_id: str
|
app_id: str
|
||||||
|
|
||||||
@ -77,10 +75,10 @@ class OutputModeration(BaseModel):
|
|||||||
return final_output
|
return final_output
|
||||||
|
|
||||||
def start_thread(self) -> threading.Thread:
|
def start_thread(self) -> threading.Thread:
|
||||||
buffer_size = int(dify_config.config.MODERATION_BUFFER_SIZE)
|
buffer_size = dify_config.MODERATION_BUFFER_SIZE
|
||||||
thread = threading.Thread(target=self.worker, kwargs={
|
thread = threading.Thread(target=self.worker, kwargs={
|
||||||
'flask_app': current_app._get_current_object(),
|
'flask_app': current_app._get_current_object(),
|
||||||
'buffer_size': buffer_size if buffer_size > 0 else self.DEFAULT_BUFFER_SIZE
|
'buffer_size': buffer_size if buffer_size > 0 else dify_config.MODERATION_BUFFER_SIZE
|
||||||
})
|
})
|
||||||
|
|
||||||
thread.start()
|
thread.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user