feat(feedback): Add content improvement feedback system

Frontend (frontend/app.js):

- Add textarea for improvement feedback

- Add submit button with loading state

- Handle API response and display improved content

Backend (backend/copywriter.py):

- Add improve_copy() method using Cohere API

- Integrate retry mechanism for API calls

Backend (backend/main.py):

- Add /improve-content POST endpoint

- Implement error handling and return improved content with metadata

Testing:

- Verified feedback submission flow

- Confirmed improved content generation

- Tested error scenarios and loading states
This commit is contained in:
Michael Ikehi
2025-04-18 04:39:06 +01:00
parent 6fd7213076
commit af8f99dea3
13 changed files with 550 additions and 167 deletions
+24 -20
View File
@@ -38,26 +38,26 @@ BRAND_NAME = os.getenv("BRAND_NAME", "Adriana James")
# Content types
CONTENT_TYPES = [
"email_campaign",
"website_copy",
"email",
"social_media",
"blog_post",
"website_copy",
"sales_copy",
"ad_copy",
"funnel_page",
"video_script",
"case_study",
"product_description",
"press_release"
"landing_page",
"press_release",
"newsletter"
]
# Tone options
# Tone options - simplified to match the core style
TONE_OPTIONS = [
"professional",
"friendly",
"excited",
"authoritative",
"casual",
"inspirational",
"empathetic",
"humorous"
"direct",
"empowering",
"confident",
"practical"
]
# Content length options
@@ -69,13 +69,17 @@ LENGTH_OPTIONS = [
# Default brand style guidelines
DEFAULT_BRAND_STYLE = {
"brand_name": BRAND_NAME,
"tone": ["professional", "friendly", "inspirational"],
"voice_characteristics": ["clear", "direct", "empowering"],
"taboo_words": ["cheap", "discount", "bargain"],
"tone": ["direct", "empowering", "confident", "practical"],
"voice_characteristics": ["clear", "authoritative", "steady", "rhythmic"],
"writing_patterns": ["direct commands", "personal pronouns", "repetitive rhythms"],
"taboo_words": ["cheap", "discount", "bargain", "failure", "impossible", "difficult"],
"preferred_terms": {
"customers": "clients",
"products": "solutions"
"problems": "challenges",
"try": "take action",
"difficult": "ready for growth",
"failure": "learning opportunity",
"hope": "know",
"maybe": "will"
}
}
@@ -84,4 +88,4 @@ LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
LOG_FILE = os.getenv("LOG_FILE", str(BASE_DIR / "logs" / "app.log"))
# Create logs directory if it doesn't exist
(BASE_DIR / "logs").mkdir(exist_ok=True)
(BASE_DIR / "logs").mkdir(exist_ok=True)