chore: replace pseudo-random generators with secrets module (#20616)
This commit is contained in:
parent
4f0c9fdf2b
commit
c1a13fa553
8 changed files with 17 additions and 16 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import logging
|
||||
import random
|
||||
import secrets
|
||||
from typing import cast
|
||||
|
||||
from core.app.entities.app_invoke_entities import ModelConfigWithCredentialsEntity
|
||||
|
|
@ -38,7 +38,7 @@ def check_moderation(tenant_id: str, model_config: ModelConfigWithCredentialsEnt
|
|||
if len(text_chunks) == 0:
|
||||
return True
|
||||
|
||||
text_chunk = random.choice(text_chunks)
|
||||
text_chunk = secrets.choice(text_chunks)
|
||||
|
||||
try:
|
||||
model_provider_factory = ModelProviderFactory(tenant_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue