update brand_syle and style_guidelines

This commit is contained in:
Ayomide
2025-07-24 17:51:21 +01:00
parent 1d3c8f88e1
commit 0d069dd6b7
4 changed files with 269 additions and 29 deletions
+114 -26
View File
@@ -1,6 +1,7 @@
from typing import Dict
import json
from pathlib import Path
from config import Config
class BrandStyle:
@@ -15,17 +16,72 @@ class BrandStyle:
def _load_style(self) -> Dict:
path = Path("data/style_guidelines/style.json")
if path.exists():
return json.loads(path.read_text())
try:
return json.loads(path.read_text())
except json.JSONDecodeError:
print(f"Warning: Invalid JSON in {path}, using default style")
return self._create_default_style(path)
else:
# Create default style if doesn't exist
default_style = {
"tone": "professional",
"phrases": ["innovative", "results-driven", "empowering", "transformation"],
"avoid": ["cheap", "guarantee", "spam", "scam"]
return self._create_default_style(path)
def _create_default_style(self, path: Path) -> Dict:
"""Create default style guide structure"""
default_style = {
"brand_name": "Adriana James",
"brand_voice": {
"primary_tone": "empowering",
"secondary_tones": ["authentic", "professional", "inspiring"],
"personality_traits": [
"confident but approachable",
"results-oriented",
"transformational",
"direct yet compassionate"
]
},
"writing_style": {
"sentence_structure": "Mix of short punchy sentences and longer explanatory ones",
"vocabulary_level": "Accessible yet sophisticated",
"perspective": "Second person (you/your) to create connection",
"active_voice_percentage": 85
},
"preferred_phrases": [
"transform your", "breakthrough results", "unlock your potential",
"proven strategies", "next-level success", "game-changing",
"step into your power", "authentic leadership"
],
"avoid_phrases": [
"cheap", "free trial", "limited time only", "guarantee",
"magic bullet", "overnight success", "easy money"
],
"call_to_action_style": {
"urgency_level": "moderate",
"action_verbs": ["discover", "unlock", "transform", "master", "elevate"],
"format": "Clear, specific, benefit-focused"
},
"target_audience": {
"primary": "ambitious professionals and entrepreneurs",
"demographics": "30-50 years old, career-focused",
"pain_points": ["feeling stuck", "lack of clarity", "imposter syndrome"],
"aspirations": ["leadership roles", "business growth", "personal fulfillment"]
},
"brand_values": [
"authenticity over perfection",
"growth through challenge",
"sustainable success",
"empowerment through education"
],
"content_guidelines": {
"storytelling": "Use personal anecdotes and client success stories",
"social_proof": "Include testimonials and case studies naturally",
"educational_value": "Always provide actionable insights",
"emotional_connection": "Address fears and aspirations directly"
}
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(default_style, indent=2))
return default_style
}
# Create directory and save default style
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(default_style, indent=2))
return default_style
def _load_template(self, name: str) -> str:
path = Path(f"data/style_guidelines/{name}_template.txt")
@@ -47,32 +103,64 @@ class BrandStyle:
if hasattr(request, 'dict'):
# It's a Pydantic model
request_dict = request.dict()
tone = request.tone or self.style['tone']
tone = request.tone or self.style.get('brand_voice', {}).get('primary_tone', 'professional')
content_type = request.content_type
else:
# It's already a dict
request_dict = request
tone = request_dict.get('tone', self.style['tone'])
tone = request_dict.get('tone', self.style.get('brand_voice', {}).get('primary_tone', 'professional'))
content_type = request_dict.get('content_type', 'general')
# Load the comprehensive style guide content
brand_voice = self.style.get('brand_voice', {})
writing_style = self.style.get('writing_style', {})
target_audience = self.style.get('target_audience', {})
content_guidelines = self.style.get('content_guidelines', {})
cta_style = self.style.get('call_to_action_style', {})
return f"""
You are a marketing assistant for Adriana James. Follow these brand guidelines:
You are a marketing copywriter for {self.style.get('brand_name', 'Adriana James')}.
TONE: {tone}
STYLE: Professional, authentic, and empowering
BRAND VOICE & PERSONALITY:
- Primary tone: {brand_voice.get('primary_tone', 'empowering')}
- Secondary tones: {', '.join(brand_voice.get('secondary_tones', []))}
- Personality traits: {', '.join(brand_voice.get('personality_traits', []))}
PREFERRED PHRASES: {', '.join(self.style['phrases'])}
AVOID USING: {', '.join(self.style['avoid'])}
WRITING STYLE REQUIREMENTS:
- Sentence structure: {writing_style.get('sentence_structure', 'Mix of short punchy sentences and longer explanatory ones')}
- Vocabulary level: {writing_style.get('vocabulary_level', 'Accessible yet sophisticated')}
- Perspective: {writing_style.get('perspective', 'Second person (you/your)')}
- Use active voice {writing_style.get('active_voice_percentage', 85)}% of the time
CONTENT TYPE: {content_type}
TEMPLATE GUIDANCE: {self.templates.get(content_type, self.templates['general'])}
TARGET AUDIENCE CONTEXT:
- Primary audience: {target_audience.get('primary', 'ambitious professionals')}
- Demographics: {target_audience.get('demographics', '30-50 years old, career-focused')}
- Main pain points: {', '.join(target_audience.get('pain_points', []))}
- Key aspirations: {', '.join(target_audience.get('aspirations', []))}
Create marketing copy that:
1. Reflects Adriana James' brand voice
2. Is engaging and authentic
3. Includes a clear value proposition
4. Has a compelling call-to-action when appropriate
5. Feels personal and relatable
PREFERRED LANGUAGE:
- Use these phrases: {', '.join(self.style.get('preferred_phrases', []))}
- NEVER use these: {', '.join(self.style.get('avoid_phrases', []))}
Remember: Focus on transformation, empowerment, and results while maintaining professionalism.
CONTENT GUIDELINES:
- Storytelling approach: {content_guidelines.get('storytelling', 'Use personal anecdotes and client success stories')}
- Social proof: {content_guidelines.get('social_proof', 'Include testimonials naturally')}
- Educational value: {content_guidelines.get('educational_value', 'Always provide actionable insights')}
- Emotional connection: {content_guidelines.get('emotional_connection', 'Address fears and aspirations directly')}
CALL-TO-ACTION STYLE:
- Urgency level: {cta_style.get('urgency_level', 'moderate')}
- Preferred action verbs: {', '.join(cta_style.get('action_verbs', []))}
- Format: {cta_style.get('format', 'Clear, specific, benefit-focused')}
BRAND VALUES TO REFLECT:
{chr(10).join(f"- {value}" for value in self.style.get('brand_values', []))}
CONTENT TYPE: {content_type.upper()}
SPECIFIC TEMPLATE GUIDANCE:
{self.templates.get(content_type, self.templates.get('general', ''))}
REQUESTED TONE FOR THIS PIECE: {tone}
Create marketing copy that embodies Adriana James' authentic, empowering brand voice while following all the above guidelines. Focus on transformation, breakthrough results, and sustainable success.
"""