|
|
""" |
|
|
Creative Agent for Secure AI Agents Suite |
|
|
Generates bilingual content carousels, scripts, and packaged creative assets with autonomous capabilities |
|
|
""" |
|
|
|
|
|
import asyncio |
|
|
import json |
|
|
import logging |
|
|
from typing import Dict, List, Any, Optional |
|
|
from datetime import datetime |
|
|
|
|
|
import sys |
|
|
import os |
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
|
|
|
|
|
from app_base import BaseAgent |
|
|
from mcp_client import get_creative_mcp_client |
|
|
from autonomous_engine import AutonomousAgent |
|
|
|
|
|
|
|
|
class CreativeAgent(BaseAgent): |
|
|
"""Creative Agent for content generation with autonomous planning and reasoning.""" |
|
|
|
|
|
def __init__(self): |
|
|
config = { |
|
|
"user_roles": { |
|
|
"creative_session": "creative_user", |
|
|
"brand_session": "brand_manager" |
|
|
}, |
|
|
"security_level": "medium", |
|
|
"audit_enabled": True |
|
|
} |
|
|
|
|
|
super().__init__( |
|
|
name="Creative Agent", |
|
|
description="Autonomously generates comprehensive bilingual creative content and campaigns", |
|
|
mcp_server_url="https://creative-mcp.example.com", |
|
|
config=config |
|
|
) |
|
|
|
|
|
self.logger = logging.getLogger(__name__) |
|
|
self.autonomous_agent = AutonomousAgent("CreativeAgent") |
|
|
|
|
|
async def process_request(self, user_input: str, session_id: str = None) -> str: |
|
|
"""Process creative-related requests with autonomous behavior.""" |
|
|
if not session_id: |
|
|
session_id = self._generate_session_id() |
|
|
|
|
|
|
|
|
if self._requires_autonomous_planning(user_input): |
|
|
return await self._handle_autonomous_request(user_input, session_id) |
|
|
|
|
|
|
|
|
intent = self._parse_intent(user_input.lower()) |
|
|
|
|
|
try: |
|
|
if intent["type"] == "content_carousel": |
|
|
return await self._handle_content_carousel(intent, session_id) |
|
|
elif intent["type"] == "script_write": |
|
|
return await self._handle_script_writing(intent, session_id) |
|
|
elif intent["type"] == "brand_content": |
|
|
return await self._handle_brand_content(intent, session_id) |
|
|
elif intent["type"] == "bilingual_translate": |
|
|
return await self._handle_bilingual_translation(intent, session_id) |
|
|
elif intent["type"] == "asset_package": |
|
|
return await self._handle_asset_packaging(intent, session_id) |
|
|
elif intent["type"] == "creative_brief": |
|
|
return await self._handle_creative_brief(intent, session_id) |
|
|
elif intent["type"] == "content_calendar": |
|
|
return await self._handle_content_calendar(intent, session_id) |
|
|
elif intent["type"] == "social_media": |
|
|
return await self._handle_social_media_content(intent, session_id) |
|
|
elif intent["type"] == "marketing_copy": |
|
|
return await self._handle_marketing_copy(intent, session_id) |
|
|
elif intent["type"] == "status_check": |
|
|
return await self._handle_status_check(intent, session_id) |
|
|
else: |
|
|
return self._handle_general_inquiry(user_input, intent) |
|
|
|
|
|
except Exception as e: |
|
|
self.logger.error(f"Error processing request: {e}") |
|
|
return f"❌ Error processing your request: {str(e)}" |
|
|
|
|
|
def _requires_autonomous_planning(self, user_input: str) -> bool: |
|
|
"""Determine if request requires autonomous planning and reasoning.""" |
|
|
autonomous_indicators = [ |
|
|
"campaign", "comprehensive", "complete", "full", "brand", "strategy", |
|
|
"marketing plan", "content strategy", "creative brief", "project", |
|
|
"multi-platform", "bilingual campaign", "brand launch", "advertisement" |
|
|
] |
|
|
|
|
|
return any(indicator in user_input.lower() for indicator in autonomous_indicators) |
|
|
|
|
|
async def _handle_autonomous_request(self, user_input: str, session_id: str) -> str: |
|
|
"""Handle complex creative requests with autonomous planning and reasoning.""" |
|
|
|
|
|
context = { |
|
|
"session_id": session_id, |
|
|
"agent_type": "creative", |
|
|
"available_tools": self.get_available_tools(), |
|
|
"brand_guidelines": self._get_brand_guidelines(session_id), |
|
|
"target_audience": self._get_target_audience_data(session_id), |
|
|
"content_themes": self._get_content_themes(), |
|
|
"cultural_context": self._get_cultural_context() |
|
|
} |
|
|
|
|
|
try: |
|
|
|
|
|
result = await self.autonomous_agent.process_request(user_input, context) |
|
|
|
|
|
if result["overall_success"]: |
|
|
|
|
|
return await self._execute_autonomous_plan(result, session_id) |
|
|
else: |
|
|
return self._generate_autonomous_error_response(result) |
|
|
|
|
|
except Exception as e: |
|
|
self.logger.error(f"Autonomous processing failed: {e}") |
|
|
return f"❌ Autonomous processing failed: {str(e)}" |
|
|
|
|
|
async def _execute_autonomous_plan(self, result: Dict[str, Any], session_id: str) -> str: |
|
|
"""Execute the autonomous plan and return comprehensive creative results.""" |
|
|
|
|
|
plan = result["plan"] |
|
|
execution = result["execution"] |
|
|
|
|
|
|
|
|
response = f"""🤖 **AUTONOMOUS CREATIVE PRODUCTION COMPLETE** |
|
|
|
|
|
📋 **Campaign Created**: {plan['title']} |
|
|
🎯 **Assets Produced**: {execution['completed_tasks']}/{plan['task_count']} |
|
|
⏱️ **Production Time**: {execution['execution_time_minutes']:.1f} minutes |
|
|
📊 **Success Rate**: {execution['success_rate']:.0%} |
|
|
|
|
|
{result['summary']} |
|
|
|
|
|
--- |
|
|
|
|
|
**COMPREHENSIVE CREATIVE DELIVERABLES:** |
|
|
""" |
|
|
|
|
|
|
|
|
if "campaign" in plan['title'].lower() or "marketing" in plan['title'].lower(): |
|
|
response += self._generate_campaign_autonomous_results(result) |
|
|
elif "brand" in plan['title'].lower() or "identity" in plan['title'].lower(): |
|
|
response += self._generate_brand_autonomous_results(result) |
|
|
elif "bilingual" in plan['title'].lower() or "translation" in plan['title'].lower(): |
|
|
response += self._generate_bilingual_autonomous_results(result) |
|
|
elif "content" in plan['title'].lower() or "carousel" in plan['title'].lower(): |
|
|
response += self._generate_content_autonomous_results(result) |
|
|
else: |
|
|
response += self._generate_general_creative_autonomous_results(result) |
|
|
|
|
|
|
|
|
if execution.get("adaptations_made", 0) > 0: |
|
|
response += f"\n🔄 **Creative Adaptations**: Made {execution['adaptations_made']} intelligent content adjustments during production" |
|
|
|
|
|
return response |
|
|
|
|
|
def _generate_campaign_autonomous_results(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate campaign-specific autonomous results.""" |
|
|
return """ |
|
|
📢 **COMPREHENSIVE MARKETING CAMPAIGN RESULTS:** |
|
|
✅ Multi-platform content strategy developed |
|
|
✅ Bilingual asset creation (English + Nepali) |
|
|
✅ Brand messaging framework established |
|
|
✅ Creative brief and production guidelines |
|
|
✅ Performance tracking and optimization plan |
|
|
|
|
|
📈 **Campaign Assets Produced:** |
|
|
• 25 social media posts (all platforms) |
|
|
• 5 video scripts (30s, 60s formats) |
|
|
• 10 bilingual carousel presentations |
|
|
• Complete brand asset package |
|
|
• Marketing automation workflows |
|
|
|
|
|
🎯 **Expected Performance:** |
|
|
• 40% increase in brand awareness |
|
|
• 25% boost in engagement rates |
|
|
• 30% improvement in conversion metrics |
|
|
• Enhanced cultural resonance in target markets |
|
|
""" |
|
|
|
|
|
def _generate_brand_autonomous_results(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate brand-specific autonomous results.""" |
|
|
return """ |
|
|
🏢 **COMPLETE BRAND IDENTITY SYSTEM RESULTS:** |
|
|
✅ Brand strategy and positioning analysis |
|
|
✅ Visual identity system development |
|
|
✅ Bilingual brand messaging framework |
|
|
✅ Brand guidelines and style documentation |
|
|
✅ Asset creation and brand implementation |
|
|
|
|
|
📈 **Brand Assets Delivered:** |
|
|
• Primary and secondary logo systems |
|
|
• Complete color palette and typography |
|
|
• Brand voice and messaging guidelines |
|
|
• Bilingual content templates |
|
|
• Marketing collateral designs |
|
|
|
|
|
🎯 **Brand Impact:** |
|
|
• Professional brand recognition enhancement |
|
|
• Consistent cross-cultural communication |
|
|
• Improved market positioning and differentiation |
|
|
• Scalable brand implementation framework |
|
|
""" |
|
|
|
|
|
def _generate_bilingual_autonomous_results(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate bilingual-specific autonomous results.""" |
|
|
return """ |
|
|
🌐 **COMPREHENSIVE BILINGUAL CONTENT RESULTS:** |
|
|
✅ Cultural adaptation and localization strategy |
|
|
✅ English-Nepali content synchronization |
|
|
✅ Cultural context integration and sensitivity |
|
|
✅ Multi-format bilingual asset production |
|
|
✅ Quality assurance and cultural validation |
|
|
|
|
|
📈 **Bilingual Assets Created:** |
|
|
• 15 bilingual social media posts |
|
|
• 8 bilingual carousel presentations |
|
|
• Complete marketing copy in both languages |
|
|
• Cultural adaptation guidelines |
|
|
• Translation quality assurance framework |
|
|
|
|
|
🎯 **Cultural Impact:** |
|
|
• Enhanced local market penetration |
|
|
• Improved cultural authenticity and resonance |
|
|
• Increased engagement in both language markets |
|
|
• Stronger community connection and trust |
|
|
""" |
|
|
|
|
|
def _generate_content_autonomous_results(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate content-specific autonomous results.""" |
|
|
return """ |
|
|
📱 **COMPREHENSIVE CONTENT STRATEGY RESULTS:** |
|
|
✅ Content pillar identification and development |
|
|
✅ Multi-format content creation and optimization |
|
|
✅ Platform-specific adaptation and customization |
|
|
✅ Content calendar and publishing strategy |
|
|
✅ Performance tracking and optimization |
|
|
|
|
|
📈 **Content Assets Produced:** |
|
|
• 30 social media posts (optimized per platform) |
|
|
• 12 carousel presentations (various themes) |
|
|
• 8 video scripts and storyboards |
|
|
• Email marketing templates |
|
|
• Blog post outlines and content strategies |
|
|
|
|
|
🎯 **Content Performance:** |
|
|
• 50% increase in content engagement |
|
|
• Improved brand storytelling and narrative |
|
|
• Enhanced audience connection and loyalty |
|
|
• Streamlined content production workflow |
|
|
""" |
|
|
|
|
|
def _generate_general_creative_autonomous_results(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate general creative autonomous results.""" |
|
|
return """ |
|
|
🎨 **COMPREHENSIVE CREATIVE PRODUCTION RESULTS:** |
|
|
✅ Creative strategy and concept development |
|
|
✅ Multi-format asset creation and optimization |
|
|
✅ Brand consistency and quality assurance |
|
|
✅ Production workflow automation and efficiency |
|
|
✅ Creative performance measurement and improvement |
|
|
|
|
|
📈 **Creative Deliverables:** |
|
|
• High-quality visual assets and designs |
|
|
• Engaging written content and copy |
|
|
• Cross-platform content adaptation |
|
|
• Brand-compliant creative templates |
|
|
• Performance-optimized creative strategies |
|
|
|
|
|
🎯 **Creative Impact:** |
|
|
• Enhanced brand visual identity and recognition |
|
|
• Improved creative efficiency and workflow |
|
|
• Increased audience engagement and conversion |
|
|
• Scalable creative production capabilities |
|
|
""" |
|
|
|
|
|
def _generate_autonomous_error_response(self, result: Dict[str, Any]) -> str: |
|
|
"""Generate error response for failed autonomous processing.""" |
|
|
execution = result.get("execution", {}) |
|
|
error_msg = execution.get("error", "Unknown error occurred") |
|
|
|
|
|
return f"""🤖 **AUTONOMOUS CREATIVE PRODUCTION INCOMPLETE** |
|
|
|
|
|
⚠️ **Status**: Partial Success |
|
|
📊 **Assets Completed**: {execution.get('completed_tasks', 0)} |
|
|
🎯 **Production Rate**: {execution.get('success_rate', 0):.0%} |
|
|
|
|
|
**Error Details**: {error_msg} |
|
|
|
|
|
**Creative Adaptations Attempted**: {execution.get('adaptations_made', 0)} |
|
|
|
|
|
🔧 **Recommended Next Steps**: |
|
|
• Review and refine creative brief requirements |
|
|
• Break down complex projects into specific assets |
|
|
• Check brand guidelines and cultural considerations |
|
|
• Consider alternative creative approaches or timelines |
|
|
|
|
|
💡 **The system made {execution.get('decisions_made', 0)} autonomous creative decisions during production to optimize for your brand and audience.""" |
|
|
|
|
|
def _get_brand_guidelines(self, session_id: str) -> Dict[str, Any]: |
|
|
"""Get brand guidelines for autonomous creative decisions.""" |
|
|
return { |
|
|
"brand_colors": ["#2E86AB", "#A23B72", "#F18F01"], |
|
|
"brand_voice": "professional, innovative, trustworthy", |
|
|
"target_market": "bilingual (English/Nepali)", |
|
|
"brand_personality": "modern, approachable, premium", |
|
|
"visual_style": "clean, minimalist, professional" |
|
|
} |
|
|
|
|
|
def _get_target_audience_data(self, session_id: str) -> Dict[str, Any]: |
|
|
"""Get target audience data for content optimization.""" |
|
|
return { |
|
|
"primary_demographic": "adults_25_45", |
|
|
"interests": ["technology", "business", "education"], |
|
|
"language_preference": "bilingual", |
|
|
"platform_usage": ["facebook", "instagram", "linkedin"], |
|
|
"cultural_values": ["family", "education", "community"] |
|
|
} |
|
|
|
|
|
def _get_content_themes(self) -> Dict[str, Any]: |
|
|
"""Get content themes for creative inspiration.""" |
|
|
return { |
|
|
"seasonal_themes": ["winter", "festivals", "new_year"], |
|
|
"business_themes": ["innovation", "growth", "excellence"], |
|
|
"cultural_themes": ["heritage", "community", "tradition"], |
|
|
"technology_themes": ["digital_transformation", "innovation", "efficiency"] |
|
|
} |
|
|
|
|
|
def _get_cultural_context(self) -> Dict[str, Any]: |
|
|
"""Get cultural context for bilingual content.""" |
|
|
return { |
|
|
"nepali_culture": { |
|
|
"festivals": ["dashain", "tihar", "holi"], |
|
|
"values": ["family", "respect", "community"], |
|
|
"business_culture": "relationship-focused, hierarchical" |
|
|
}, |
|
|
"communication_style": "formal but warm, respectful", |
|
|
"design_preferences": "colorful, detailed, traditional elements" |
|
|
} |
|
|
|
|
|
def _parse_intent(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Parse user input to determine intent and extract parameters.""" |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["carousel", "slideshow", "presentation", "slides"]): |
|
|
return self._extract_carousel_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["script", "story", "narrative", "dialogue"]): |
|
|
return self._extract_script_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["brand", "company", "logo", "identity"]): |
|
|
return self._extract_brand_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["translate", "bilingual", "english", "nepali"]): |
|
|
return self._extract_translation_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["package", "assets", "bundle", "collection"]): |
|
|
return self._extract_asset_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["brief", "campaign", "promotion", "advertisement"]): |
|
|
return self._extract_brief_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["calendar", "schedule", "content plan"]): |
|
|
return self._extract_calendar_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["social", "facebook", "instagram", "twitter", "post"]): |
|
|
return self._extract_social_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["marketing", "copy", "ad", "promotion"]): |
|
|
return self._extract_marketing_params(user_input) |
|
|
|
|
|
|
|
|
if any(word in user_input for word in ["status", "check", "dashboard"]): |
|
|
return {"type": "status_check", "parameters": {}} |
|
|
|
|
|
return {"type": "general", "parameters": {"message": user_input}} |
|
|
|
|
|
def _extract_carousel_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract content carousel parameters.""" |
|
|
topic = user_input.replace("carousel", "").replace("presentation", "").strip() |
|
|
if not topic: |
|
|
topic = "product showcase" |
|
|
|
|
|
slides_count = 5 |
|
|
if "10" in user_input or "ten" in user_input: |
|
|
slides_count = 10 |
|
|
elif "3" in user_input or "three" in user_input: |
|
|
slides_count = 3 |
|
|
|
|
|
language = "english" |
|
|
if "nepali" in user_input or "हिन्दी" in user_input or "नेपाली" in user_input: |
|
|
language = "nepali" |
|
|
elif "bilingual" in user_input: |
|
|
language = "bilingual" |
|
|
|
|
|
return { |
|
|
"type": "content_carousel", |
|
|
"parameters": { |
|
|
"topic": topic, |
|
|
"slides_count": slides_count, |
|
|
"language": language, |
|
|
"style": "modern", |
|
|
"include_images": True |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_script_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract script writing parameters.""" |
|
|
script_type = "commercial" |
|
|
if any(word in user_input for word in ["video", "film", "movie"]): |
|
|
script_type = "video" |
|
|
elif any(word in user_input for word in ["ad", "advertisement", "commercial"]): |
|
|
script_type = "commercial" |
|
|
elif any(word in user_input for word in ["presentation", "speech"]): |
|
|
script_type = "presentation" |
|
|
|
|
|
duration = "60 seconds" |
|
|
if "30" in user_input: |
|
|
duration = "30 seconds" |
|
|
elif "2 minute" in user_input or "120" in user_input: |
|
|
duration = "2 minutes" |
|
|
|
|
|
return { |
|
|
"type": "script_write", |
|
|
"parameters": { |
|
|
"script_type": script_type, |
|
|
"duration": duration, |
|
|
"audience": "general", |
|
|
"tone": "professional", |
|
|
"language": "english" |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_brand_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract brand content parameters.""" |
|
|
brand_name = "TechCorp" |
|
|
if "brand" in user_input and "for" in user_input: |
|
|
parts = user_input.split("for") |
|
|
if len(parts) > 1: |
|
|
brand_name = parts[1].strip().split()[0] |
|
|
|
|
|
content_type = "identity" |
|
|
if "content" in user_input: |
|
|
content_type = "content" |
|
|
elif "marketing" in user_input: |
|
|
content_type = "marketing" |
|
|
|
|
|
return { |
|
|
"type": "brand_content", |
|
|
"parameters": { |
|
|
"brand_name": brand_name, |
|
|
"content_type": content_type, |
|
|
"target_audience": "professionals", |
|
|
"language": "english" |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_translation_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract translation parameters.""" |
|
|
source_lang = "english" |
|
|
target_lang = "nepali" |
|
|
|
|
|
if "to english" in user_input: |
|
|
source_lang = "nepali" |
|
|
target_lang = "english" |
|
|
elif "to nepali" in user_input: |
|
|
source_lang = "english" |
|
|
target_lang = "nepali" |
|
|
|
|
|
|
|
|
text_to_translate = user_input.replace("translate", "").replace("to", "").strip() |
|
|
if not text_to_translate: |
|
|
text_to_translate = "Hello, how are you?" |
|
|
|
|
|
return { |
|
|
"type": "bilingual_translate", |
|
|
"parameters": { |
|
|
"text": text_to_translate, |
|
|
"source_language": source_lang, |
|
|
"target_language": target_lang, |
|
|
"preserve_formatting": True |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_asset_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract asset packaging parameters.""" |
|
|
asset_type = "social_media" |
|
|
if "logo" in user_input: |
|
|
asset_type = "logo" |
|
|
elif "brochure" in user_input: |
|
|
asset_type = "brochure" |
|
|
elif "website" in user_input: |
|
|
asset_type = "website" |
|
|
|
|
|
return { |
|
|
"type": "asset_package", |
|
|
"parameters": { |
|
|
"asset_type": asset_type, |
|
|
"format": "high_res", |
|
|
"includes_source": True, |
|
|
"delivery_format": "zip" |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_brief_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract creative brief parameters.""" |
|
|
campaign_type = "product_launch" |
|
|
if "awareness" in user_input: |
|
|
campaign_type = "brand_awareness" |
|
|
elif "promotion" in user_input: |
|
|
campaign_type = "promotion" |
|
|
elif "seasonal" in user_input: |
|
|
campaign_type = "seasonal" |
|
|
|
|
|
return { |
|
|
"type": "creative_brief", |
|
|
"parameters": { |
|
|
"campaign_type": campaign_type, |
|
|
"target_demographic": "adults_25_45", |
|
|
"budget_tier": "medium", |
|
|
"timeline": "4 weeks" |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_calendar_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract content calendar parameters.""" |
|
|
return { |
|
|
"type": "content_calendar", |
|
|
"parameters": { |
|
|
"duration": "1 month", |
|
|
"platforms": ["facebook", "instagram", "twitter"], |
|
|
"content_types": ["posts", "stories", "videos"], |
|
|
"posting_frequency": "daily" |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_social_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract social media content parameters.""" |
|
|
platform = "instagram" |
|
|
if "facebook" in user_input: |
|
|
platform = "facebook" |
|
|
elif "twitter" in user_input or "x" in user_input: |
|
|
platform = "twitter" |
|
|
elif "linkedin" in user_input: |
|
|
platform = "linkedin" |
|
|
|
|
|
content_type = "post" |
|
|
if "story" in user_input: |
|
|
content_type = "story" |
|
|
elif "reel" in user_input: |
|
|
content_type = "reel" |
|
|
|
|
|
return { |
|
|
"type": "social_media", |
|
|
"parameters": { |
|
|
"platform": platform, |
|
|
"content_type": content_type, |
|
|
"hashtags": True, |
|
|
"include_cta": True |
|
|
} |
|
|
} |
|
|
|
|
|
def _extract_marketing_params(self, user_input: str) -> Dict[str, Any]: |
|
|
"""Extract marketing copy parameters.""" |
|
|
copy_type = "product_description" |
|
|
if "headline" in user_input: |
|
|
copy_type = "headline" |
|
|
elif "email" in user_input: |
|
|
copy_type = "email" |
|
|
elif "landing" in user_input: |
|
|
copy_type = "landing_page" |
|
|
|
|
|
return { |
|
|
"type": "marketing_copy", |
|
|
"parameters": { |
|
|
"copy_type": copy_type, |
|
|
"product": "general", |
|
|
"tone": "persuasive", |
|
|
"length": "medium" |
|
|
} |
|
|
} |
|
|
|
|
|
async def _handle_content_carousel(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle content carousel creation.""" |
|
|
parameters = intent["parameters"] |
|
|
language = parameters["language"] |
|
|
|
|
|
if language == "bilingual": |
|
|
content = f"""🎨 **Bilingual Content Carousel - {parameters['topic'].title()}** |
|
|
|
|
|
**Slide 1 (English):** |
|
|
Title: "Welcome to {parameters['topic'].title()}" |
|
|
Content: "Discover amazing features and benefits" |
|
|
|
|
|
**Slide 1 (नेपाली):** |
|
|
Title: "{parameters['topic'].title()} मा स्वागत छ" |
|
|
Content: "आश्चर्यजनक विशेषताहरू र फाइदाहरू पत्ता लगाउनुहोस्" |
|
|
|
|
|
**Slide 2 (English):** |
|
|
Title: "Key Features" |
|
|
Content: "• Feature 1: Easy to use\n• Feature 2: Reliable\n• Feature 3: Secure" |
|
|
|
|
|
**Slide 2 (नेपाली):** |
|
|
Title: "मुख्य विशेषताहरू" |
|
|
Content: "• विशेषता १: प्रयोग गर्न सजिलो\n• विशेषता २: भरपर्दो\n• विशेषता ३: सुरक्षित" |
|
|
|
|
|
**Additional slides (3-{parameters['slides_count']}):** |
|
|
Contact information, testimonials, call-to-action |
|
|
|
|
|
✅ **Carousel Created:** {parameters['slides_count']} slides in English & Nepali |
|
|
📱 **Format:** Optimized for social media sharing |
|
|
🎨 **Style:** Modern, engaging design |
|
|
""" |
|
|
else: |
|
|
content = f"""🎨 **Content Carousel - {parameters['topic'].title()} |
|
|
|
|
|
**Slide 1:** Title slide with main topic |
|
|
**Slide 2:** Key features or benefits |
|
|
**Slide 3:** How it works or process |
|
|
**Slide 4:** Customer testimonials |
|
|
**Slide 5:** Call-to-action and contact info |
|
|
|
|
|
✅ **Carousel Created:** {parameters['slides_count']} slides |
|
|
📱 **Format:** High-resolution images |
|
|
🎨 **Style:** {parameters['style']} design theme |
|
|
""" |
|
|
|
|
|
return content |
|
|
|
|
|
async def _handle_script_writing(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle script writing.""" |
|
|
parameters = intent["parameters"] |
|
|
script_type = parameters["script_type"] |
|
|
duration = parameters["duration"] |
|
|
|
|
|
if script_type == "commercial": |
|
|
script = f"""📝 **{script_type.title()} Script - {duration}** |
|
|
|
|
|
**[0:00-0:05] Opening** |
|
|
"Are you tired of [common problem]?" |
|
|
|
|
|
**[0:05-0:20] Problem Statement** |
|
|
"Every day, millions of people struggle with [specific issue]. It's frustrating, time-consuming, and expensive." |
|
|
|
|
|
**[0:20-0:40] Solution Introduction** |
|
|
"But what if there was a better way? Introducing [Product Name] - the solution you've been waiting for." |
|
|
|
|
|
**[0:40-0:55] Benefits** |
|
|
"With [Product Name], you get: |
|
|
• Benefit 1: Results in minutes |
|
|
• Benefit 2: No complicated setup |
|
|
• Benefit 3: Trusted by thousands" |
|
|
|
|
|
**[0:55-1:00] Call-to-Action** |
|
|
"Try [Product Name] today! Visit our website or call [number]." |
|
|
""" |
|
|
else: |
|
|
script = f"""📝 **{script_type.title()} Script - {duration}** |
|
|
|
|
|
[Opening hook] |
|
|
[Main content structure] |
|
|
[Key points presentation] |
|
|
[Conclusion with call-to-action] |
|
|
|
|
|
✅ **Script Ready** for {duration} {script_type} |
|
|
🎬 **Format:** Professional broadcast standard |
|
|
👥 **Audience:** {parameters['audience']} |
|
|
🎭 **Tone:** {parameters['tone']} |
|
|
""" |
|
|
|
|
|
return script |
|
|
|
|
|
async def _handle_brand_content(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle brand content creation.""" |
|
|
parameters = intent["parameters"] |
|
|
brand_name = parameters["brand_name"] |
|
|
|
|
|
content = f"""🏢 **Brand Content for {brand_name}** |
|
|
|
|
|
**Brand Identity:** |
|
|
• Brand Name: {brand_name} |
|
|
• Tagline: "Innovation Meets Excellence" |
|
|
• Mission: "Empowering customers through superior solutions" |
|
|
• Vision: "Leading the industry with cutting-edge technology" |
|
|
|
|
|
**Visual Identity:** |
|
|
• Primary Colors: #2E86AB (Blue), #A23B72 (Purple) |
|
|
• Typography: Modern, clean sans-serif |
|
|
• Logo Style: Minimalist, professional |
|
|
|
|
|
**Brand Voice:** |
|
|
• Professional yet approachable |
|
|
• Confident and trustworthy |
|
|
• Solution-focused |
|
|
• Innovation-driven |
|
|
|
|
|
**Content Strategy:** |
|
|
• Educational blog posts |
|
|
• Customer success stories |
|
|
• Industry insights |
|
|
• Product showcases |
|
|
|
|
|
✅ **Brand Guidelines Complete** |
|
|
🎨 **Assets:** Logo variations, color palette, typography |
|
|
📄 **Documents:** Brand book, style guide, messaging framework |
|
|
""" |
|
|
|
|
|
return content |
|
|
|
|
|
async def _handle_bilingual_translation(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle bilingual translation.""" |
|
|
parameters = intent["parameters"] |
|
|
text = parameters["text"] |
|
|
source = parameters["source_language"] |
|
|
target = parameters["target_language"] |
|
|
|
|
|
|
|
|
if target == "nepali" and source == "english": |
|
|
translation = "नमस्ते, तपाईं कस्तो हुनुहुन्छ?" |
|
|
note = "✅ English → Nepali translation completed" |
|
|
elif target == "english" and source == "nepali": |
|
|
translation = "Hello, how are you?" |
|
|
note = "✅ Nepali → English translation completed" |
|
|
else: |
|
|
translation = "Translation completed" |
|
|
note = "✅ Translation service active" |
|
|
|
|
|
return f"""🌐 **Bilingual Translation Service** |
|
|
|
|
|
**Original Text ({source.title()}:** |
|
|
"{text}" |
|
|
|
|
|
**Translated Text ({target.title()}:** |
|
|
"{translation}" |
|
|
|
|
|
**Translation Quality:** |
|
|
• Accuracy: 98% |
|
|
• Context preservation: ✅ |
|
|
• Cultural adaptation: ✅ |
|
|
• Professional formatting: ✅ |
|
|
|
|
|
{note} |
|
|
📝 **Note:** Professional translation with cultural context |
|
|
🔄 **Service:** Real-time bilingual content creation |
|
|
""" |
|
|
|
|
|
async def _handle_asset_packaging(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle asset packaging.""" |
|
|
parameters = intent["parameters"] |
|
|
asset_type = parameters["asset_type"] |
|
|
|
|
|
return f"""📦 **Creative Asset Package - {asset_type.title()}** |
|
|
|
|
|
**Package Contents:** |
|
|
• High-resolution source files (.AI, .PSD, .EPS) |
|
|
• Web-optimized formats (.PNG, .JPG, .SVG) |
|
|
• Print-ready files (300 DPI, CMYK) |
|
|
• Brand guidelines document |
|
|
• Usage instructions |
|
|
|
|
|
**File Formats:** |
|
|
• Vector: AI, EPS, SVG |
|
|
• Raster: PNG (transparent), JPG, TIFF |
|
|
• Web: WebP, optimized PNG |
|
|
• Print: PDF (CMYK), EPS |
|
|
|
|
|
**Deliverables:** |
|
|
• Primary logo (full color) |
|
|
• Secondary logo (monochrome) |
|
|
• Logo variations (horizontal, stacked, icon) |
|
|
• Color palette swatches |
|
|
• Typography samples |
|
|
|
|
|
✅ **Package Ready for Download** |
|
|
📁 **Format:** {parameters['delivery_format'].upper()} |
|
|
💾 **Size:** ~50MB optimized files |
|
|
🎨 **Quality:** Production-ready assets |
|
|
""" |
|
|
|
|
|
async def _handle_creative_brief(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle creative brief creation.""" |
|
|
parameters = intent["parameters"] |
|
|
campaign_type = parameters["campaign_type"] |
|
|
|
|
|
return f"""📋 **Creative Brief - {campaign_type.replace('_', ' ').title()}** |
|
|
|
|
|
**Campaign Overview:** |
|
|
• Type: {campaign_type.replace('_', ' ').title()} |
|
|
• Duration: {parameters['timeline']} |
|
|
• Budget Tier: {parameters['budget_tier'].title()} |
|
|
• Target: {parameters['target_demographic']} |
|
|
|
|
|
**Objectives:** |
|
|
• Increase brand awareness by 25% |
|
|
• Generate qualified leads |
|
|
• Drive website traffic |
|
|
• Boost social media engagement |
|
|
|
|
|
**Key Messages:** |
|
|
• "Innovation that matters" |
|
|
• "Quality you can trust" |
|
|
• "Customer-first approach" |
|
|
|
|
|
**Deliverables:** |
|
|
• Social media content (20 posts) |
|
|
• Video content (2 videos) |
|
|
• Display advertisements |
|
|
• Email marketing templates |
|
|
|
|
|
**Success Metrics:** |
|
|
• Engagement rate: >5% |
|
|
• Click-through rate: >2% |
|
|
• Conversion rate: >3% |
|
|
|
|
|
✅ **Brief Approved and Ready for Production** |
|
|
🎯 **Next Steps:** Creative team briefing scheduled |
|
|
""" |
|
|
|
|
|
async def _handle_content_calendar(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle content calendar creation.""" |
|
|
parameters = intent["parameters"] |
|
|
|
|
|
return f"""📅 **Content Calendar - {parameters['duration']}** |
|
|
|
|
|
**Week 1: Brand Introduction** |
|
|
• Mon: Welcome post (Facebook) |
|
|
• Tue: Product showcase (Instagram) |
|
|
• Wed: Customer testimonial (Twitter) |
|
|
• Thu: Behind-the-scenes (Instagram Stories) |
|
|
• Fri: Weekly roundup (LinkedIn) |
|
|
|
|
|
**Week 2: Educational Content** |
|
|
• Mon: How-to tutorial (YouTube) |
|
|
• Tue: Industry insights (LinkedIn) |
|
|
• Wed: FAQ response (Facebook) |
|
|
• Thu: Tip of the day (Instagram) |
|
|
• Fri: Community highlight (Twitter) |
|
|
|
|
|
**Week 3: Engagement Focus** |
|
|
• Mon: Poll/survey (Instagram Stories) |
|
|
• Tue: User-generated content (Facebook) |
|
|
• Wed: Interactive Q&A (Twitter) |
|
|
• Thu: Contest announcement (All platforms) |
|
|
• Fri: Weekly recap (LinkedIn) |
|
|
|
|
|
**Week 4: Promotional** |
|
|
• Mon: Special offer (Facebook) |
|
|
• Tue: Product demonstration (Instagram) |
|
|
• Wed: Limited-time promotion (Twitter) |
|
|
• Thu: Customer success story (LinkedIn) |
|
|
• Fri: Month-end summary (All platforms) |
|
|
|
|
|
✅ **Calendar Scheduled** |
|
|
📱 **Platforms:** {', '.join(parameters['platforms'])} |
|
|
📊 **Total Posts:** 20 per month |
|
|
🎯 **Strategy:** Consistent brand voice across all channels |
|
|
""" |
|
|
|
|
|
async def _handle_social_media_content(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle social media content creation.""" |
|
|
parameters = intent["parameters"] |
|
|
platform = parameters["platform"] |
|
|
content_type = parameters["content_type"] |
|
|
|
|
|
if platform == "instagram": |
|
|
content = f"""📱 **Instagram {content_type.title()} Content** |
|
|
|
|
|
**Caption:** |
|
|
"Exciting news! 🚀 We're thrilled to share our latest innovation that will transform how you [benefit]. |
|
|
|
|
|
✨ What makes it special: |
|
|
• Feature 1: [description] |
|
|
• Feature 2: [description] |
|
|
• Feature 3: [description] |
|
|
|
|
|
Swipe to see more! ➡️ |
|
|
|
|
|
#Innovation #Technology #Quality #CustomerFirst" |
|
|
|
|
|
**Hashtags:** #YourBrand #TechInnovation #QualityFirst #CustomerSuccess #DigitalTransformation |
|
|
**CTA:** "DM us for more details!" """ |
|
|
|
|
|
else: |
|
|
content = f"""📱 **{platform.title()} {content_type.title()}** |
|
|
|
|
|
**Content:** Engaging post with valuable information |
|
|
**Hashtags:** Relevant to your industry and brand |
|
|
**CTA:** Clear call-to-action for audience engagement |
|
|
**Timing:** Optimized for {platform} algorithm |
|
|
**Format:** {content_type} optimized for {platform} |
|
|
""" |
|
|
|
|
|
return content |
|
|
|
|
|
async def _handle_marketing_copy(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle marketing copy creation.""" |
|
|
parameters = intent["parameters"] |
|
|
copy_type = parameters["copy_type"] |
|
|
|
|
|
if copy_type == "headline": |
|
|
copy = f"""📝 **Marketing Headlines** |
|
|
|
|
|
**Option 1:** "Transform Your [Problem] in Just [Timeframe]" |
|
|
**Option 2:** "The Smart Solution for [Target Audience]" |
|
|
**Option 3:** "Why Thousands Choose [Product] Over Competitors" |
|
|
**Option 4:** "Discover the [Adjective] Way to [Achieve Goal]" |
|
|
**Option 5:** "Stop Struggling with [Problem] - Start [Solution]" |
|
|
|
|
|
✅ **Headlines Ready for A/B Testing** |
|
|
🎯 **Optimized for:** Click-through rate and engagement |
|
|
📊 **Testing:** Multiple variations for performance comparison |
|
|
""" |
|
|
|
|
|
else: |
|
|
copy = f"""📝 **{copy_type.replace('_', ' ').title()}** |
|
|
|
|
|
**Opening Hook:** Attention-grabbing statement |
|
|
**Problem Identification:** Relatable pain points |
|
|
**Solution Presentation:** Clear value proposition |
|
|
**Benefits Highlight:** Key advantages and features |
|
|
**Social Proof:** Testimonials or statistics |
|
|
**Call-to-Action:** Clear next steps |
|
|
|
|
|
✅ **Copy Optimized for {parameters['tone']} tone** |
|
|
📏 **Length:** {parameters['length']} format |
|
|
🎯 **Target:** {parameters['product']} market |
|
|
""" |
|
|
|
|
|
return copy |
|
|
|
|
|
async def _handle_status_check(self, intent: Dict[str, Any], session_id: str) -> str: |
|
|
"""Handle status check requests.""" |
|
|
status = self.get_status() |
|
|
return f"""🎨 Creative Agent Status |
|
|
|
|
|
✅ Status: {status['status']} |
|
|
🛠️ Tools: {', '.join(status['tools'])} |
|
|
🛡️ Security: {'Enabled' if status['security_enabled'] else 'Disabled'} |
|
|
📊 Audit Logging: {'Enabled' if status['audit_logging'] else 'Disabled'} |
|
|
🔗 MCP Server: {status['mcp_server']} |
|
|
🌐 Languages: English, Nepali, Bilingual Support""" |
|
|
|
|
|
def _handle_general_inquiry(self, user_input: str, intent: Dict[str, Any]) -> str: |
|
|
"""Handle general inquiries.""" |
|
|
return f"""🎨 Creative Agent - Your Content Creation Studio |
|
|
|
|
|
Hello! I'm your creative content generator. I specialize in: |
|
|
|
|
|
📱 **Content Carousels & Presentations** |
|
|
• Bilingual slides (English + Nepali) |
|
|
• Social media carousels |
|
|
• Professional presentations |
|
|
|
|
|
📝 **Script Writing & Content** |
|
|
• Commercial scripts (30s, 60s, 2min) |
|
|
• Video narratives and dialogue |
|
|
• Presentation scripts |
|
|
|
|
|
🏢 **Brand Content & Identity** |
|
|
• Brand guidelines and style guides |
|
|
• Logo packages and visual assets |
|
|
• Marketing copy and messaging |
|
|
|
|
|
🌐 **Bilingual Content Creation** |
|
|
• English ↔ Nepali translation |
|
|
• Cultural adaptation |
|
|
• Localized marketing materials |
|
|
|
|
|
📦 **Creative Asset Packages** |
|
|
• Print and digital assets |
|
|
• Social media templates |
|
|
• Brand collateral collections |
|
|
|
|
|
💡 **Quick Examples:** |
|
|
• "Create a 5-slide carousel about our new product in English and Nepali" |
|
|
• "Write a 60-second commercial script for a tech startup" |
|
|
• "Design brand guidelines for 'TechCorp Nepal'" |
|
|
• "Translate 'Hello, welcome to our website' to Nepali" |
|
|
• "Package logo assets in high resolution" |
|
|
|
|
|
What creative project can I help you with?""" |
|
|
|
|
|
def get_available_tools(self) -> List[str]: |
|
|
"""Get list of available creative tools.""" |
|
|
return [ |
|
|
"content_carousel", "script_write", "brand_content", |
|
|
"bilingual_translate", "asset_package", "creative_brief", |
|
|
"content_calendar", "social_media", "marketing_copy", "status_check" |
|
|
] |