"feat:enhance-podcast-topic-ai"
This commit is contained in:
@@ -23,9 +23,15 @@ def track_agent_usage_sync(user_id: str, model_name: str, prompt: str, response_
|
||||
provider_enum = APIProvider.GEMINI
|
||||
actual_provider_name = "gemini"
|
||||
elif "gpt" in model_lower or "openai" in model_lower or "mistral" in model_lower:
|
||||
# HuggingFace/Mistral often mapped to gpt-oss or mistral
|
||||
provider_enum = APIProvider.MISTRAL
|
||||
actual_provider_name = "huggingface"
|
||||
# Check if it's WaveSpeed vs HuggingFace based on context or model naming
|
||||
# WaveSpeed models don't have :cerebras suffix, HF models do
|
||||
if ":cerebras" in model_name.lower() or "huggingface" in model_name.lower():
|
||||
provider_enum = APIProvider.MISTRAL
|
||||
actual_provider_name = "huggingface"
|
||||
else:
|
||||
# Assume WaveSpeed for gpt models without provider suffix
|
||||
provider_enum = APIProvider.WAVESPEED
|
||||
actual_provider_name = "wavespeed"
|
||||
elif "claude" in model_lower or "anthropic" in model_lower:
|
||||
provider_enum = APIProvider.ANTHROPIC
|
||||
actual_provider_name = "anthropic"
|
||||
|
||||
@@ -340,6 +340,7 @@ class BaseALwrityAgent(ABC):
|
||||
prompt=prompt,
|
||||
user_id=self.user_id,
|
||||
preferred_hf_models=LOW_COST_REMOTE_MODELS,
|
||||
flow_type="sif_agent",
|
||||
),
|
||||
)
|
||||
logger.warning(
|
||||
|
||||
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
from loguru import logger
|
||||
from .base import SIFBaseAgent, TXTAI_AVAILABLE, Agent
|
||||
from services.intelligence.agents.core_agent_framework import BaseALwrityAgent, TaskProposal
|
||||
from services.database import has_onboarding_session
|
||||
|
||||
try:
|
||||
from services.intelligence.sif_integration import SIFIntegrationService
|
||||
@@ -22,11 +23,16 @@ class CompetitorResponseAgent(BaseALwrityAgent):
|
||||
super().__init__(user_id, "competitor_analyst", shared_llm_name, llm, **kwargs)
|
||||
|
||||
self.sif_service = None
|
||||
if SIF_AVAILABLE:
|
||||
if SIF_AVAILABLE and has_onboarding_session(user_id):
|
||||
try:
|
||||
self.sif_service = SIFIntegrationService(user_id)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to initialize SIF service for CompetitorResponseAgent: {e}")
|
||||
elif SIF_AVAILABLE:
|
||||
logger.debug(
|
||||
"Skipping SIF service initialization for CompetitorResponseAgent user {}: no onboarding session",
|
||||
user_id,
|
||||
)
|
||||
|
||||
def _create_txtai_agent(self):
|
||||
"""Create a specialized txtai Agent for competitor analysis."""
|
||||
|
||||
@@ -8,6 +8,7 @@ from .base import SIFBaseAgent, TXTAI_AVAILABLE, Agent
|
||||
from services.intelligence.agents.core_agent_framework import BaseALwrityAgent, TaskProposal
|
||||
from services.seo_tools.content_strategy_service import ContentStrategyService
|
||||
from services.analytics import PlatformAnalyticsService
|
||||
from services.database import has_onboarding_session
|
||||
|
||||
try:
|
||||
from services.intelligence.sif_integration import SIFIntegrationService
|
||||
@@ -26,11 +27,16 @@ class ContentStrategyAgent(BaseALwrityAgent):
|
||||
|
||||
self.sif_service = None
|
||||
self.content_strategy_service = ContentStrategyService()
|
||||
if SIF_AVAILABLE:
|
||||
if SIF_AVAILABLE and has_onboarding_session(user_id):
|
||||
try:
|
||||
self.sif_service = SIFIntegrationService(user_id)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to initialize SIF service for ContentStrategyAgent: {e}")
|
||||
elif SIF_AVAILABLE:
|
||||
logger.debug(
|
||||
"Skipping SIF service initialization for ContentStrategyAgent user {}: no onboarding session",
|
||||
user_id,
|
||||
)
|
||||
|
||||
def _create_txtai_agent(self):
|
||||
"""Create a specialized txtai Agent for content strategy with tools."""
|
||||
|
||||
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
from loguru import logger
|
||||
from .base import SIFBaseAgent, TXTAI_AVAILABLE, Agent
|
||||
from services.intelligence.agents.core_agent_framework import BaseALwrityAgent, TaskProposal
|
||||
from services.database import has_onboarding_session
|
||||
|
||||
try:
|
||||
from services.intelligence.sif_integration import SIFIntegrationService
|
||||
@@ -22,11 +23,16 @@ class SEOOptimizationAgent(BaseALwrityAgent):
|
||||
super().__init__(user_id, "seo_specialist", shared_llm_name, llm, **kwargs)
|
||||
|
||||
self.sif_service = None
|
||||
if SIF_AVAILABLE:
|
||||
if SIF_AVAILABLE and has_onboarding_session(user_id):
|
||||
try:
|
||||
self.sif_service = SIFIntegrationService(user_id)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to initialize SIF service for SEOOptimizationAgent: {e}")
|
||||
elif SIF_AVAILABLE:
|
||||
logger.debug(
|
||||
"Skipping SIF service initialization for SEOOptimizationAgent user {}: no onboarding session",
|
||||
user_id,
|
||||
)
|
||||
|
||||
def _create_txtai_agent(self):
|
||||
"""Create a specialized txtai Agent for SEO optimization."""
|
||||
|
||||
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
from loguru import logger
|
||||
from .base import SIFBaseAgent, TXTAI_AVAILABLE, Agent
|
||||
from services.intelligence.agents.core_agent_framework import BaseALwrityAgent, TaskProposal
|
||||
from services.database import has_onboarding_session
|
||||
|
||||
try:
|
||||
from services.intelligence.sif_integration import SIFIntegrationService
|
||||
@@ -22,11 +23,16 @@ class SocialAmplificationAgent(BaseALwrityAgent):
|
||||
super().__init__(user_id, "social_media_manager", shared_llm_name, llm, **kwargs)
|
||||
|
||||
self.sif_service = None
|
||||
if SIF_AVAILABLE:
|
||||
if SIF_AVAILABLE and has_onboarding_session(user_id):
|
||||
try:
|
||||
self.sif_service = SIFIntegrationService(user_id)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to initialize SIF service for SocialAmplificationAgent: {e}")
|
||||
elif SIF_AVAILABLE:
|
||||
logger.debug(
|
||||
"Skipping SIF service initialization for SocialAmplificationAgent user {}: no onboarding session",
|
||||
user_id,
|
||||
)
|
||||
|
||||
def _create_txtai_agent(self):
|
||||
"""Create a specialized txtai Agent for social media."""
|
||||
|
||||
Reference in New Issue
Block a user