feat: move model request to plugin daemon

This commit is contained in:
takatost
2024-09-29 00:13:53 +08:00
parent d9cced8419
commit 1c3213184e
1070 changed files with 1072 additions and 87428 deletions

View File

@ -23,6 +23,9 @@ def check_moderation(model_config: ModelConfigWithCredentialsEntity, text: str)
if using_provider_type == ProviderType.SYSTEM and provider_name in moderation_config.providers:
hosting_openai_config = hosting_configuration.provider_map["openai"]
if hosting_openai_config.credentials is None:
return False
# 2000 text per chunk
length = 2000
text_chunks = [text[i : i + length] for i in range(0, len(text), length)]