Files
social-media-automation/app/data/content_templates.py
Consultoría AS 964e38564a feat(phase-3): Complete AI content generation system
- Add /api/generate endpoints for AI content generation
- Integrate DeepSeek AI into dashboard compose page
- Add content templates for tips, products, services, engagement
- Implement batch generation for weekly/monthly calendars
- Add cost estimation endpoint

New endpoints:
- POST /api/generate/tip - Generate tech tips
- POST /api/generate/product - Generate product posts
- POST /api/generate/service - Generate service posts
- POST /api/generate/thread - Generate educational threads
- POST /api/generate/response - Generate response suggestions
- POST /api/generate/adapt - Adapt content to platform
- POST /api/generate/improve - Improve existing content
- POST /api/generate/batch - Batch generate for calendar
- GET /api/generate/batch/estimate - Estimate batch costs
- GET /api/generate/status - Check AI connection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 01:49:49 +00:00

270 lines
7.8 KiB
Python
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Plantillas predefinidas para generación de contenido.
Estas plantillas guían a la IA para generar contenido consistente.
"""
# ============================================================
# TIPS TECH
# ============================================================
TIP_TEMPLATES = {
"productividad": [
"Tip de productividad: [herramienta/técnica] puede ahorrarte [tiempo/esfuerzo] al [tarea]. #Productividad",
"¿Sabías que [atajo/función] en [app/sistema] puede [beneficio]? #TipTech",
"3 segundos que te ahorran 30 minutos: [tip rápido]. #Eficiencia",
],
"seguridad": [
"Tip de seguridad: [acción] para proteger [recurso]. Nunca [error común]. #Ciberseguridad",
"¿Tu [dispositivo/cuenta] está protegido? Verifica que tengas [medida de seguridad]. #SeguridadDigital",
"Error común de seguridad: [error]. Solución: [solución]. #InfoSec",
],
"ia": [
"Prompt tip: Para mejores resultados con IA, [técnica]. #IAparaNegocios",
"Herramienta IA del día: [herramienta] te ayuda a [beneficio]. #InteligenciaArtificial",
"Cómo uso IA para [tarea]: [paso breve]. #ProductividadIA",
],
"programacion": [
"Code tip: [técnica/patrón] mejora [aspecto] en tu código. #DevTips",
"Atajo en [IDE/lenguaje]: [atajo] → [resultado]. #ProgrammingTips",
"Evita este error común en [tecnología]: [error] → [solución]. #CodeQuality",
],
"hardware": [
"Tip de hardware: [acción] para [beneficio] en tu [equipo]. #TechTips",
"¿Tu PC está lenta? Prueba [solución]. #Mantenimiento",
"Antes de comprar [componente], verifica [aspecto]. #CompraTech",
],
"impresion3d": [
"Tip 3D: [configuración/técnica] mejora [aspecto] de tus impresiones. #Impresion3D",
"Material del día: [filamento] es ideal para [uso]. #3DPrinting",
"Error común en 3D: [problema] → Solución: [solución]. #Makers",
],
"general": [
"Tip tech del día: [consejo general]. #Tecnologia",
"¿Conocías este truco? [tip]. #TechTips",
"Tecnología que facilita tu día: [herramienta/técnica]. #Tech",
]
}
# ============================================================
# PRODUCTOS
# ============================================================
PRODUCT_TEMPLATES = {
"computadoras": """
🖥️ {name}
{highlight_1}
{highlight_2}
{highlight_3}
💰 ${price:,.0f} MXN
{call_to_action}
#Computadoras #Tech #Tijuana
""",
"laptops": """
💻 {name}
{highlight_1}
{highlight_2}
{highlight_3}
Precio: ${price:,.0f} MXN
{call_to_action}
#Laptops #Portátiles #Tech
""",
"impresoras3d": """
🔧 {name}
Lo que puedes crear:
• Prototipos
• Piezas personalizadas
• Figuras y modelos
{specs_summary}
💰 ${price:,.0f} MXN
{call_to_action}
#Impresion3D #3DPrinting #Makers
""",
"accesorios": """
{emoji} {name}
{description}
${price:,.0f} MXN
{call_to_action}
#Accesorios #Tech
""",
}
# ============================================================
# SERVICIOS
# ============================================================
SERVICE_TEMPLATES = {
"consultoria": """
🎯 {name}
¿{pain_point}?
Te ayudamos a:
{benefit_1}
{benefit_2}
{benefit_3}
{call_to_action}
#ConsultoríaTech #TransformaciónDigital
""",
"desarrollo": """
💻 {name}
Desarrollamos soluciones a medida:
{feature_1}
{feature_2}
{feature_3}
{call_to_action}
#DesarrolloSoftware #Automatización
""",
"soporte": """
🛠️ {name}
Problemas técnicos resueltos:
{issue_1}
{issue_2}
{issue_3}
{call_to_action}
#SoporteTécnico #IT #Tijuana
""",
"capacitacion": """
📚 {name}
Aprende:
🎓 {topic_1}
🎓 {topic_2}
🎓 {topic_3}
{call_to_action}
#Capacitación #TechTraining
""",
}
# ============================================================
# ENGAGEMENT
# ============================================================
ENGAGEMENT_TEMPLATES = {
"pregunta": [
"🤔 ¿Cuál es tu mayor reto con [tema]? Cuéntanos en los comentarios.",
"Pregunta del día: ¿[pregunta relevante]? 👇",
"Si pudieras automatizar UNA tarea de tu trabajo, ¿cuál sería? 🤖",
],
"encuesta": [
"¿Qué prefieres?\n\n🅰️ [Opción A]\n🅱️ [Opción B]\n\nResponde con el emoji.",
"Tu herramienta favorita para [tarea]:\n\n1⃣ [Op1]\n2⃣ [Op2]\n3⃣ [Op3]\n4⃣ Otra (comenta)",
],
"behind_scenes": [
"Un día normal en @ConsultoriaAS: [actividad]. ¿Qué les gustaría ver? 👀",
"Trabajando en [proyecto]. Pronto más detalles... 🔜",
],
"celebracion": [
"🎉 [Logro/Milestone]. ¡Gracias a todos los que confían en nosotros!",
"Otro [proyecto/cliente] satisfecho. Esto es lo que nos motiva 💪",
],
}
# ============================================================
# HILOS EDUCATIVOS
# ============================================================
THREAD_TEMPLATES = {
"tutorial": {
"hook": "🧵 [Título llamativo en forma de promesa]\n\nEn este hilo te explico paso a paso 👇",
"content_format": "{number}/ {step_title}\n\n{explanation}",
"closing": "📌 Guarda este hilo para cuando lo necesites.\n\n¿Te fue útil? RT para que llegue a más personas.\n\n#[hashtag1] #[hashtag2]"
},
"tips_list": {
"hook": "🧵 {count} tips de {topic} que ojalá hubiera sabido antes:\n\n👇",
"content_format": "{number}/ {tip}",
"closing": "¿Cuál agregarías tú?\n\nSíguenos para más tips como estos.\n\n#[hashtag1] #[hashtag2]"
},
"comparison": {
"hook": "🧵 {option_a} vs {option_b}: ¿Cuál elegir?\n\nTe lo explico 👇",
"content_format": "{number}/ {aspect}:\n\n{option_a}: {value_a}\n{option_b}: {value_b}",
"closing": "Mi recomendación: {recommendation}\n\n¿Con cuál te quedas?\n\n#[hashtag1] #[hashtag2]"
},
}
# ============================================================
# HORARIOS ÓPTIMOS
# ============================================================
OPTIMAL_POSTING_TIMES = {
"x": {
"weekday": ["09:00", "12:00", "17:00", "20:00"],
"weekend": ["10:00", "14:00", "19:00"],
"best": "12:00"
},
"threads": {
"weekday": ["08:00", "12:00", "18:00"],
"weekend": ["10:00", "15:00"],
"best": "18:00"
},
"instagram": {
"weekday": ["11:00", "14:00", "19:00"],
"weekend": ["10:00", "14:00", "20:00"],
"best": "19:00"
},
"facebook": {
"weekday": ["09:00", "13:00", "16:00"],
"weekend": ["12:00", "15:00"],
"best": "13:00"
},
}
# ============================================================
# HELPERS
# ============================================================
def get_tip_template(category: str) -> str:
"""Obtener plantilla aleatoria para un tip."""
import random
templates = TIP_TEMPLATES.get(category, TIP_TEMPLATES["general"])
return random.choice(templates)
def get_product_template(category: str) -> str:
"""Obtener plantilla para producto."""
return PRODUCT_TEMPLATES.get(category, PRODUCT_TEMPLATES["accesorios"])
def get_service_template(category: str) -> str:
"""Obtener plantilla para servicio."""
return SERVICE_TEMPLATES.get(category, SERVICE_TEMPLATES["consultoria"])
def get_engagement_template(template_type: str) -> str:
"""Obtener plantilla de engagement."""
import random
templates = ENGAGEMENT_TEMPLATES.get(template_type, ENGAGEMENT_TEMPLATES["pregunta"])
return random.choice(templates)
def get_optimal_times(platform: str, is_weekend: bool = False) -> list:
"""Obtener horarios óptimos para publicar."""
times = OPTIMAL_POSTING_TIMES.get(platform, OPTIMAL_POSTING_TIMES["x"])
return times["weekend"] if is_weekend else times["weekday"]