from services.utils import run_analysis SYSTEM_PROMPT = """You are a TikTok viral strategist. Return ONLY a valid JSON object (not an array).""" DEFAULTS = { "video_concepts": [{"hook": "You won't believe this", "script_snippet": "Here's the full story...", "sound_suggestion": "Trending audio"}], "trending_angles": ["Educational angle on this topic"], "hashtags": ["#fyp", "#trending"], "best_posting_time": "7-9 AM or 7-10 PM local time", "viral_strategies": ["Use trending sounds", "Post 1-3x daily"] } def analyze_tiktok(content: str) -> dict: messages = [ {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": f'Topic: "{content[:1000]}"\nReturn a JSON object (not an array) with these keys:\n- video_concepts (2 items, each with "hook" + "script_snippet" + "sound_suggestion")\n- trending_angles (2 items)\n- hashtags (3 items)\n- best_posting_time (string)\n- viral_strategies (2 items)'} ] return run_analysis(messages, defaults=DEFAULTS, temperature=0.4, max_new_tokens=800)