When ChatGPT generates a code snippet, the filename shown in the top-left corner of the code block (e.g., “Scrape Thales Text”) does not accurately reflect the script being generated. Instead, it appears to show the name of the canvas session or some prior document title. This is misleading, especially in sessions involving multiple scripts.
Steps to Reproduce:
- Ask ChatGPT to generate multiple Python scripts for different purposes.
- Observe the filename shown in the upper left of the rendered code block.
- Compare it to the actual filename stated or used in the script content.
Expected Result: The filename in the code block UI should match the intended filename of the script (e.g., upload-files.py
, dedupe_and_clean.py
) — especially if the script itself starts with a # Filename:
comment.
Actual Result: The UI displays a generic or unrelated label (like “Scrape Thales Text”) that doesn’t reflect the file’s real or intended name, potentially causing confusion and misattribution of scripts.
Impact: In sessions involving many scripts, this can lead to incorrect file identification, accidental overwrites, or user errors during deployment.
Suggested Fix: Allow the model to explicitly specify the filename for the code block header (perhaps via metadata or a # Filename:
comment). At the very least, avoid using irrelevant labels not derived from the code context.