Description
If the OpenRouter API fails, the backend falls back to a deterministic draft. However, if the user had manually edited the email body in the UI, the fallback logic might incorrectly overwrite their edits during the launch phase.
Steps to Reproduce
- Configure campaign without AI key.
- Edit email step manually in the builder.
- Launch campaign.
- Observe the sent emails use the fallback template instead of manual edits.
Expected Behavior
The AI generation should only happen when explicitly requested via the "AI Generate" button, OR it should respect a flag use_ai_generation=True. It should not unconditionally overwrite the content field.
Implementation Hints
# backend/campaigns/tasks.py
if step.use_ai:
content = generate_with_ai(...)
else:
content = step.content
Description
If the OpenRouter API fails, the backend falls back to a deterministic draft. However, if the user had manually edited the email body in the UI, the fallback logic might incorrectly overwrite their edits during the launch phase.
Steps to Reproduce
Expected Behavior
The AI generation should only happen when explicitly requested via the "AI Generate" button, OR it should respect a flag
use_ai_generation=True. It should not unconditionally overwrite thecontentfield.Implementation Hints