fix: Fix YAML syntax errors and validator prompt formatting
- Fix YAML files with unquoted strings containing quotes - Export singleton instances in ai/__init__.py - Fix validator scoring prompt to use replace() instead of format() to avoid conflicts with JSON curly braces Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ topics_to_cover:
|
||||
- Automatización de tareas repetitivas
|
||||
|
||||
avoid:
|
||||
- "Levántate a las 5am" sin contexto
|
||||
- '"Levántate a las 5am" sin contexto'
|
||||
- Hustle culture tóxica
|
||||
- Productividad como fin en sí misma
|
||||
- Consejos que solo funcionan para privilegiados
|
||||
|
||||
@@ -68,7 +68,7 @@ avoid:
|
||||
- Más de 2 hashtags
|
||||
- Emojis excesivos
|
||||
- Links en el medio del texto
|
||||
- "Hilo:" sin contenido de hilo real
|
||||
- '"Hilo:" sin contenido de hilo real'
|
||||
|
||||
adaptation_rules: |
|
||||
Cuando adaptes contenido para X:
|
||||
|
||||
@@ -78,5 +78,5 @@ tone_guidelines:
|
||||
- "¿Te interesa? Escríbenos para más detalles"
|
||||
dont:
|
||||
- "¡¡¡OFERTA INCREÍBLE!!!"
|
||||
- "ÚLTIMAS UNIDADES" (a menos que sea verdad)
|
||||
- '"ÚLTIMAS UNIDADES" (a menos que sea verdad)'
|
||||
- "Compra ahora antes de que se acabe"
|
||||
|
||||
@@ -9,16 +9,23 @@ Este módulo contiene los componentes del motor de generación de contenido:
|
||||
- ContentValidator: Validación y scoring con IA
|
||||
"""
|
||||
|
||||
from app.services.ai.prompt_library import PromptLibrary
|
||||
from app.services.ai.context_engine import ContextEngine
|
||||
from app.services.ai.generator import ContentGeneratorV2
|
||||
from app.services.ai.platform_adapter import PlatformAdapter
|
||||
from app.services.ai.validator import ContentValidator
|
||||
from app.services.ai.prompt_library import PromptLibrary, prompt_library
|
||||
from app.services.ai.context_engine import ContextEngine, context_engine
|
||||
from app.services.ai.generator import ContentGeneratorV2, content_generator_v2
|
||||
from app.services.ai.platform_adapter import PlatformAdapter, platform_adapter
|
||||
from app.services.ai.validator import ContentValidator, content_validator
|
||||
|
||||
__all__ = [
|
||||
# Classes
|
||||
"PromptLibrary",
|
||||
"ContextEngine",
|
||||
"ContentGeneratorV2",
|
||||
"PlatformAdapter",
|
||||
"ContentValidator",
|
||||
# Singleton instances
|
||||
"prompt_library",
|
||||
"context_engine",
|
||||
"content_generator_v2",
|
||||
"platform_adapter",
|
||||
"content_validator",
|
||||
]
|
||||
|
||||
@@ -261,11 +261,8 @@ class ContentValidator:
|
||||
if not scoring_prompt:
|
||||
scoring_prompt = self._default_scoring_prompt()
|
||||
|
||||
# Renderizar prompt
|
||||
prompt = scoring_prompt.format(
|
||||
content=content,
|
||||
platform=platform
|
||||
)
|
||||
# Renderizar prompt usando replace para evitar problemas con JSON
|
||||
prompt = scoring_prompt.replace("{content}", content).replace("{platform}", platform)
|
||||
|
||||
# Llamar a DeepSeek
|
||||
response = self.client.chat.completions.create(
|
||||
@@ -340,7 +337,7 @@ CRITERIOS (suma = 100):
|
||||
- CTA (0-10): ¿CTA claro si aplica?
|
||||
|
||||
RESPONDE EN JSON:
|
||||
{{"total": N, "breakdown": {{"hook_strength": N, "clarity": N, "actionability": N, "originality": N, "brand_voice": N, "cta_effectiveness": N}}, "feedback": "sugerencia"}}"""
|
||||
{"total": N, "breakdown": {"hook_strength": N, "clarity": N, "actionability": N, "originality": N, "brand_voice": N, "cta_effectiveness": N}, "feedback": "sugerencia"}"""
|
||||
|
||||
def _extract_score_from_text(self, text: str) -> Dict:
|
||||
"""Extraer score de texto si falla JSON parsing."""
|
||||
|
||||
Reference in New Issue
Block a user