diff --git a/app.py b/app.py index aabea29..f9243de 100644 --- a/app.py +++ b/app.py @@ -335,7 +335,7 @@ def get_activities(): def generate_artifact_name(): """Generate a meaningful filename for an artifact using AI. - Returns a 1-3 word filename with dashes based on what the code does. + Returns a 1-3 word filename with underscores based on what the code does. Respects ENABLE_CODE_GEN_FILENAMES environment variable (enabled by default). """ # Check if feature is enabled (default: true) @@ -359,16 +359,16 @@ def generate_artifact_name(): Rules: - Output ONLY the filename, nothing else - Use 1-3 words maximum -- Use lowercase with dashes between words (e.g., "fizzbuzz" or "hello-world" or "prime-checker") +- Use lowercase with underscores between words (e.g., "fizzbuzz" or "hello_world" or "prime_checker") - NO file extension - NO explanations or commentary - Be specific about what the code does Examples: -- Code that prints "Hello World" → "hello-world" -- Code that checks for prime numbers → "prime-checker" +- Code that prints "Hello World" → "hello_world" +- Code that checks for prime numbers → "prime_checker" - Code that plays FizzBuzz → "fizzbuzz" -- Code that sorts an array → "array-sort" +- Code that sorts an array → "array_sort" - Code that calculates factorial → "factorial" """ @@ -389,12 +389,12 @@ Examples: # Clean up the filename (remove quotes, extensions, whitespace) filename = filename.strip('"\'') filename = filename.split('.')[0] # Remove any extension - filename = filename.replace(' ', '-') + filename = filename.replace(' ', '_') filename = filename.lower() - # Validate filename (alphanumeric and dashes only) + # Validate filename (alphanumeric and underscores only) import re - if not re.match(r'^[a-z0-9-]+$', filename): + if not re.match(r'^[a-z0-9_]+$', filename): filename = "compiled_binary" # Ensure it's not too long (max 50 chars)