Spaces:
Sleeping
Sleeping
| """ | |
| Generation configuration settings for the LinkedIn Post Generator | |
| """ | |
| # Post length configurations | |
| POST_LENGTHS = { | |
| "Short (100-200 words)": {"min_words": 100, "max_words": 200}, | |
| "Medium (200-400 words)": {"min_words": 200, "max_words": 400}, | |
| "Long (400-600 words)": {"min_words": 400, "max_words": 600} | |
| } | |
| # Tone configurations | |
| TONES = { | |
| "Professional": "formal, business-like, authoritative", | |
| "Casual": "friendly, conversational, approachable", | |
| "Enthusiastic": "energetic, passionate, motivating", | |
| "Educational": "informative, instructional, helpful", | |
| "Inspirational": "motivational, uplifting, encouraging" | |
| } | |
| # Default settings | |
| DEFAULT_SETTINGS = { | |
| "post_length": "Medium (200-400 words)", | |
| "tone": "Professional", | |
| "include_hashtags": True, | |
| "include_call_to_action": True, | |
| "max_hashtags": 5, | |
| "include_emoji": True | |
| } | |
| # Hashtag suggestions for common topics | |
| HASHTAG_SUGGESTIONS = { | |
| "ai": ["#AI", "#ArtificialIntelligence", "#MachineLearning", "#Tech", "#Innovation"], | |
| "leadership": ["#Leadership", "#Management", "#Business", "#ProfessionalDevelopment", "#Career"], | |
| "remote_work": ["#RemoteWork", "#WorkFromHome", "#Productivity", "#DigitalTransformation", "#FutureOfWork"], | |
| "healthcare": ["#Healthcare", "#HealthTech", "#DigitalHealth", "#Innovation", "#PatientCare"], | |
| "business": ["#Business", "#Entrepreneurship", "#Strategy", "#Growth", "#Success"] | |
| } | |
| def get_generation_prompt(user_input, context="", settings=None): | |
| """ | |
| Generate a formatted prompt for the AI agent based on user input and settings | |
| """ | |
| if settings is None: | |
| settings = DEFAULT_SETTINGS | |
| prompt = f"Create a LinkedIn post about: {user_input}" | |
| if context: | |
| prompt += f"\n\nContext: {context}" | |
| # Add length requirements | |
| length_config = POST_LENGTHS.get(settings.get("post_length", DEFAULT_SETTINGS["post_length"])) | |
| prompt += f"\n\nLength: {length_config['min_words']}-{length_config['max_words']} words" | |
| # Add tone requirements | |
| tone = settings.get("tone", DEFAULT_SETTINGS["tone"]) | |
| tone_description = TONES.get(tone, TONES["Professional"]) | |
| prompt += f"\n\nTone: {tone_description}" | |
| # Add hashtag requirements | |
| if settings.get("include_hashtags", True): | |
| max_hashtags = settings.get("max_hashtags", 5) | |
| prompt += f"\n\nInclude {max_hashtags} relevant hashtags at the end" | |
| # Add call to action requirements | |
| if settings.get("include_call_to_action", True): | |
| prompt += "\n\nInclude a call to action at the end" | |
| # Add emoji requirements | |
| if settings.get("include_emoji", True): | |
| prompt += "\n\nUse emojis sparingly but effectively to enhance readability" | |
| # Add LinkedIn-specific formatting | |
| prompt += "\n\nFormat the post for LinkedIn with proper paragraph breaks and engaging opening" | |
| return prompt | |
| def get_hashtag_suggestions(topic): | |
| """ | |
| Get hashtag suggestions based on the topic | |
| """ | |
| topic_lower = topic.lower() | |
| for key, hashtags in HASHTAG_SUGGESTIONS.items(): | |
| if key in topic_lower: | |
| return hashtags | |
| # Return general hashtags if no specific match | |
| return ["#LinkedIn", "#Professional", "#Networking", "#Career", "#Business"] |