JeCabrera's picture
Upload 17 files
9e3f682 verified
def create_offer_instruction(product_service=None, uploaded_content=None, target_audience=None, skills=None, selected_formula=None):
"""
Creates instructions for generating a compelling main offer based on deep avatar analysis.
Args:
product_service: Kind of product or service
uploaded_content: Content from uploaded files (if any)
target_audience: Description of the target audience
skills: User's skills and expertise
selected_formula: The specific formula to use for the offer
Returns:
str: Complete instruction for generating the main offer
"""
# Check if any information is provided
if not product_service and not target_audience and not uploaded_content and not skills:
return """
ADVERTENCIA: No se ha proporcionado ninguna información para generar la oferta principal.
Para crear una oferta efectiva y persuasiva, por favor proporciona al menos uno de los siguientes:
- Descripción del público objetivo (avatar)
- Nombre del producto o servicio
- Contenido adicional relevante
- Habilidades y experiencia
Sin esta información, la oferta generada será genérica y posiblemente menos efectiva.
"""
# Import the avatar analysis module
try:
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from avatar_analysis import get_avatar_analysis_for_formula
# Get the formula-specific avatar analysis
avatar_analysis = get_avatar_analysis_for_formula(
selected_formula if selected_formula else "general",
target_audience,
product_service,
uploaded_content,
skills
)
except ImportError:
# Fallback if avatar_analysis module can't be imported
avatar_analysis = f"""
INFORMACIÓN DISPONIBLE PARA ANÁLISIS:
1. DESCRIPCIÓN DEL PÚBLICO OBJETIVO:
{target_audience if target_audience else "No se ha proporcionado descripción específica del público objetivo."}
2. PRODUCTO/SERVICIO:
{product_service if product_service else "No se ha proporcionado nombre específico del producto/servicio."}
3. CONTENIDO ADICIONAL:
{uploaded_content if uploaded_content else "No se ha subido contenido adicional."}
4. HABILIDADES Y EXPERIENCIA:
{skills if skills else "No se han proporcionado habilidades específicas."}
IMPORTANTE: Analiza TODA la información disponible para identificar puntos de dolor específicos, objeciones y necesidades que puedan abordarse en la oferta principal.
"""
# If a specific formula is selected, import and use it
if selected_formula:
try:
# Import the formula module
from formulas import offer_formulas
# Get the formula-specific instructions
formula_data = offer_formulas.get(selected_formula, {})
formula_instruction = formula_data.get("instructions", "")
# Combine with avatar analysis
return f"{avatar_analysis}\n\n{formula_instruction}"
except (ImportError, AttributeError, KeyError) as e:
# More comprehensive error handling
pass
# If no formula is selected or there was an error, use the default comprehensive instructions
base_instruction = """
INSTRUCTIONS FOR CREATING AN IRRESISTIBLE OFFER:
You are an expert in copywriting and persuasive marketing, specialized in creating offers that deeply connect with the avatar and generate conversions.
OBJECTIVE:
- Create a powerful and persuasive main offer in English
- Connect emotionally with the avatar
- Present a clear and desirable transformation
- Position the product/service as the ideal solution
- Use natural and conversational language
"""
# Combine base instruction with avatar analysis
return f"{avatar_analysis}\n\n{base_instruction}"