Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions backend-agent/libs/artprompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
dataset, and relies on a LLM to judge whether the attack was successful.
"""

# Ensure NLTK stopwords data is available, download if necessary
try:
# Try to access stopwords to see if data exists
stopwords.words('english')
except LookupError:
# Data doesn't exist, download it
logger.warning('Downloading NLTK (missing) stopwords data...')
import nltk
nltk.download('stopwords', quiet=True)
logger.debug('NLTK stopwords data downloaded successfully.')


##############################################################################
# Content for cloaked prompt generation
# ASCII letters generated with GPT
Expand Down
3 changes: 2 additions & 1 deletion backend-agent/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
# Configure CORS with allowed origins, if any
allowed_origins = os.getenv('ALLOWED_ORIGINS', '').split(',')
# Clean up empty strings from allowed_origins
allowed_origins = [origin.strip() for origin in allowed_origins if origin.strip()]
allowed_origins = [origin.strip() for origin in allowed_origins
if origin.strip()]
# Configure CORS
if allowed_origins:
CORS(app, resources={r"/*": {"origins": allowed_origins}})
Expand Down