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-21 17:32:33 +01:00
parent 6d07556b85
commit c1a894ad50
11 changed files with 1001 additions and 1471 deletions
+20 -23
View File
@@ -71,7 +71,7 @@
<option value="newsletter">Newsletter</option>
</select>
</div>
<div class="form-group">
<label for="length">Length</label>
<select id="length">
@@ -152,7 +152,7 @@
<h2>Content Templates</h2>
<p>Use pre-built templates for faster content creation.</p>
</div>
<div class="templates-grid">
<div class="template-card">
<div class="template-icon"><i class="fas fa-envelope"></i></div>
@@ -193,7 +193,7 @@
<h2>Content History</h2>
<p>View and reuse your previously generated content.</p>
</div>
<div class="history-filters">
<div class="form-group">
<select id="history-filter-type">
@@ -227,38 +227,36 @@
<section id="brand-style-page" class="page">
<div class="page-header">
<h2>Brand Style Guidelines</h2>
<p>Customize the AI to match Adriana James' brand voice and tone.</p>
<p>Adriana James' brand voice and tone guidelines are fixed to maintain consistency.</p>
<div class="alert alert-info">
<i class="fas fa-info-circle"></i>
<span>The brand style is locked to Adriana James' distinct communication style—both in her written and spoken tone. This ensures all content maintains her authentic voice.</span>
</div>
</div>
<div class="brand-style-form">
<div class="form-section">
<h3>Brand Tone</h3>
<p>Select the tone options that best represent the brand.</p>
<div class="tag-selector" id="tone-selector">
<span class="tag selected">professional</span>
<span class="tag selected">friendly</span>
<span class="tag selected">inspirational</span>
<p>Adriana James' distinctive tone is characterized by:</p>
<div class="tag-selector read-only" id="tone-selector">
<span class="tag selected">empowering</span>
<span class="tag">excited</span>
<span class="tag">authoritative</span>
<span class="tag">casual</span>
<span class="tag">humorous</span>
<span class="tag selected">assertive</span>
<span class="tag selected">inspirational</span>
<span class="tag selected">direct</span>
</div>
<p class="style-description">Her tone carries a motivational coach-like clarity, using embedded commands and cause-effect statements that inspire action.</p>
</div>
<div class="form-section">
<h3>Voice Characteristics</h3>
<p>Define the key characteristics of the brand voice.</p>
<div class="tag-selector" id="voice-selector">
<p>Adriana James speaks with these distinctive characteristics:</p>
<div class="tag-selector read-only" id="voice-selector">
<span class="tag selected">clear</span>
<span class="tag selected">direct</span>
<span class="tag selected">empowering</span>
<span class="tag selected">confident</span>
<span class="tag selected">authentic</span>
<span class="tag">innovative</span>
<span class="tag">visionary</span>
<span class="tag">approachable</span>
<span class="tag selected">conversational</span>
<span class="tag selected">teaching</span>
</div>
<p class="style-description">She speaks with conviction and clarity, using simple language to communicate profound ideas. Instead of saying "This might help you," she would say "You can do this—because your unconscious mind already knows how."</p>
</div>
<div class="form-section">
@@ -339,8 +337,7 @@
</div>
<div class="form-actions">
<button id="save-brand-style" class="btn btn-primary">Save Brand Style</button>
<button id="reset-brand-style" class="btn btn-outline">Reset to Defaults</button>
<p class="style-note"><i class="fas fa-lock"></i> Brand style settings are locked to maintain Adriana James' authentic voice across all content.</p>
</div>
</div>
</section>