JeCabrera/Perfect_Webinar_FrameWork
0
1def create_offer_instruction(product_service=None, uploaded_content=None, target_audience=None, skills=None, selected_formula=None):
2 """
3 Creates instructions for generating a compelling main offer based on deep avatar analysis.
4
5 Args:
6 product_service: Kind of product or service
7 uploaded_content: Content from uploaded files (if any)
8 target_audience: Description of the target audience
9 skills: User's skills and expertise
10 selected_formula: The specific formula to use for the offer
11
12 Returns:
13 str: Complete instruction for generating the main offer
14 """
15 # Check if any information is provided
16 if not product_service and not target_audience and not uploaded_content and not skills:
17 return """
18 ADVERTENCIA: No se ha proporcionado ninguna información para generar la oferta principal.
19
20 Para crear una oferta efectiva y persuasiva, por favor proporciona al menos uno de los siguientes:
21 - Descripción del público objetivo (avatar)
22 - Nombre del producto o servicio
23 - Contenido adicional relevante
24 - Habilidades y experiencia
25
26 Sin esta información, la oferta generada será genérica y posiblemente menos efectiva.
27 """
28
29 # Import the avatar analysis module
30 try:
31 import sys
32 import os
33 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
34 from avatar_analysis import get_avatar_analysis_for_formula
35
36 # Get the formula-specific avatar analysis
37 avatar_analysis = get_avatar_analysis_for_formula(
38 selected_formula if selected_formula else "general",
39 target_audience,
40 product_service,
41 uploaded_content,
42 skills
43 )
44 except ImportError:
45 # Fallback if avatar_analysis module can't be imported
46 avatar_analysis = f"""
47 INFORMACIÓN DISPONIBLE PARA ANÁLISIS:
48
49 1. DESCRIPCIÓN DEL PÚBLICO OBJETIVO:
50 {target_audience if target_audience else "No se ha proporcionado descripción específica del público objetivo."}
51
52 2. PRODUCTO/SERVICIO:
53 {product_service if product_service else "No se ha proporcionado nombre específico del producto/servicio."}
54
55 3. CONTENIDO ADICIONAL:
56 {uploaded_content if uploaded_content else "No se ha subido contenido adicional."}
57
58 4. HABILIDADES Y EXPERIENCIA:
59 {skills if skills else "No se han proporcionado habilidades específicas."}
60
61 IMPORTANTE: Analiza TODA la información disponible para identificar puntos de dolor específicos, objeciones y necesidades que puedan abordarse en la oferta principal.
62 """
63
64 # If a specific formula is selected, import and use it
65 if selected_formula:
66 try:
67 # Import the formula module
68 from formulas import offer_formulas
69
70 # Get the formula-specific instructions
71 formula_data = offer_formulas.get(selected_formula, {})
72 formula_instruction = formula_data.get("instructions", "")
73
74 # Combine with avatar analysis
75 return f"{avatar_analysis}\n\n{formula_instruction}"
76 except (ImportError, AttributeError, KeyError) as e:
77 # More comprehensive error handling
78 pass
79
80 # If no formula is selected or there was an error, use the default comprehensive instructions
81 base_instruction = """
82 INSTRUCTIONS FOR CREATING AN IRRESISTIBLE OFFER:
83
84 You are an expert in copywriting and persuasive marketing, specialized in creating offers that deeply connect with the avatar and generate conversions.
85
86 OBJECTIVE:
87 - Create a powerful and persuasive main offer in English
88 - Connect emotionally with the avatar
89 - Present a clear and desirable transformation
90 - Position the product/service as the ideal solution
91 - Use natural and conversational language
92 """
93
94 # Combine base instruction with avatar analysis
95 return f"{avatar_analysis}\n\n{base_instruction}"