Base code
This commit is contained in:
79
backend/api/facebook_writer/models/__init__.py
Normal file
79
backend/api/facebook_writer/models/__init__.py
Normal file
@@ -0,0 +1,79 @@
|
||||
"""Facebook Writer API Models."""
|
||||
|
||||
from .post_models import (
|
||||
FacebookPostRequest,
|
||||
FacebookPostResponse,
|
||||
FacebookPostAnalytics,
|
||||
FacebookPostOptimization
|
||||
)
|
||||
from .story_models import (
|
||||
FacebookStoryRequest,
|
||||
FacebookStoryResponse
|
||||
)
|
||||
from .reel_models import (
|
||||
FacebookReelRequest,
|
||||
FacebookReelResponse
|
||||
)
|
||||
from .carousel_models import (
|
||||
FacebookCarouselRequest,
|
||||
FacebookCarouselResponse
|
||||
)
|
||||
from .event_models import (
|
||||
FacebookEventRequest,
|
||||
FacebookEventResponse
|
||||
)
|
||||
from .hashtag_models import (
|
||||
FacebookHashtagRequest,
|
||||
FacebookHashtagResponse
|
||||
)
|
||||
from .engagement_models import (
|
||||
FacebookEngagementRequest,
|
||||
FacebookEngagementResponse
|
||||
)
|
||||
from .group_post_models import (
|
||||
FacebookGroupPostRequest,
|
||||
FacebookGroupPostResponse
|
||||
)
|
||||
from .page_about_models import (
|
||||
FacebookPageAboutRequest,
|
||||
FacebookPageAboutResponse
|
||||
)
|
||||
from .ad_copy_models import (
|
||||
FacebookAdCopyRequest,
|
||||
FacebookAdCopyResponse
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# Post models
|
||||
"FacebookPostRequest",
|
||||
"FacebookPostResponse",
|
||||
"FacebookPostAnalytics",
|
||||
"FacebookPostOptimization",
|
||||
# Story models
|
||||
"FacebookStoryRequest",
|
||||
"FacebookStoryResponse",
|
||||
# Reel models
|
||||
"FacebookReelRequest",
|
||||
"FacebookReelResponse",
|
||||
# Carousel models
|
||||
"FacebookCarouselRequest",
|
||||
"FacebookCarouselResponse",
|
||||
# Event models
|
||||
"FacebookEventRequest",
|
||||
"FacebookEventResponse",
|
||||
# Hashtag models
|
||||
"FacebookHashtagRequest",
|
||||
"FacebookHashtagResponse",
|
||||
# Engagement models
|
||||
"FacebookEngagementRequest",
|
||||
"FacebookEngagementResponse",
|
||||
# Group post models
|
||||
"FacebookGroupPostRequest",
|
||||
"FacebookGroupPostResponse",
|
||||
# Page about models
|
||||
"FacebookPageAboutRequest",
|
||||
"FacebookPageAboutResponse",
|
||||
# Ad copy models
|
||||
"FacebookAdCopyRequest",
|
||||
"FacebookAdCopyResponse"
|
||||
]
|
||||
114
backend/api/facebook_writer/models/ad_copy_models.py
Normal file
114
backend/api/facebook_writer/models/ad_copy_models.py
Normal file
@@ -0,0 +1,114 @@
|
||||
"""Pydantic models for Facebook Ad Copy functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class AdObjective(str, Enum):
|
||||
"""Ad objective options."""
|
||||
BRAND_AWARENESS = "Brand awareness"
|
||||
REACH = "Reach"
|
||||
TRAFFIC = "Traffic"
|
||||
ENGAGEMENT = "Engagement"
|
||||
APP_INSTALLS = "App installs"
|
||||
VIDEO_VIEWS = "Video views"
|
||||
LEAD_GENERATION = "Lead generation"
|
||||
MESSAGES = "Messages"
|
||||
CONVERSIONS = "Conversions"
|
||||
CATALOG_SALES = "Catalog sales"
|
||||
STORE_TRAFFIC = "Store traffic"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class AdFormat(str, Enum):
|
||||
"""Ad format options."""
|
||||
SINGLE_IMAGE = "Single image"
|
||||
SINGLE_VIDEO = "Single video"
|
||||
CAROUSEL = "Carousel"
|
||||
SLIDESHOW = "Slideshow"
|
||||
COLLECTION = "Collection"
|
||||
INSTANT_EXPERIENCE = "Instant experience"
|
||||
|
||||
|
||||
class TargetAge(str, Enum):
|
||||
"""Target age groups."""
|
||||
TEENS = "13-17"
|
||||
YOUNG_ADULTS = "18-24"
|
||||
MILLENNIALS = "25-34"
|
||||
GEN_X = "35-44"
|
||||
MIDDLE_AGED = "45-54"
|
||||
SENIORS = "55-64"
|
||||
ELDERLY = "65+"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class AdBudget(str, Enum):
|
||||
"""Ad budget ranges."""
|
||||
SMALL = "$10-50/day"
|
||||
MEDIUM = "$50-200/day"
|
||||
LARGE = "$200-1000/day"
|
||||
ENTERPRISE = "$1000+/day"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class TargetingOptions(BaseModel):
|
||||
"""Targeting options for the ad."""
|
||||
age_group: TargetAge = Field(..., description="Target age group")
|
||||
custom_age: Optional[str] = Field(None, description="Custom age range if 'Custom' is selected")
|
||||
gender: Optional[str] = Field(None, description="Gender targeting")
|
||||
location: Optional[str] = Field(None, description="Geographic targeting")
|
||||
interests: Optional[str] = Field(None, description="Interest-based targeting")
|
||||
behaviors: Optional[str] = Field(None, description="Behavior-based targeting")
|
||||
lookalike_audience: Optional[str] = Field(None, description="Lookalike audience description")
|
||||
|
||||
|
||||
class FacebookAdCopyRequest(BaseModel):
|
||||
"""Request model for Facebook ad copy generation."""
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
product_service: str = Field(..., description="Product or service being advertised")
|
||||
ad_objective: AdObjective = Field(..., description="Main objective of the ad campaign")
|
||||
custom_objective: Optional[str] = Field(None, description="Custom objective if 'Custom' is selected")
|
||||
ad_format: AdFormat = Field(..., description="Format of the ad")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
targeting_options: TargetingOptions = Field(..., description="Detailed targeting options")
|
||||
unique_selling_proposition: str = Field(..., description="What makes your offer unique")
|
||||
offer_details: Optional[str] = Field(None, description="Special offers, discounts, or promotions")
|
||||
budget_range: AdBudget = Field(..., description="Ad budget range")
|
||||
custom_budget: Optional[str] = Field(None, description="Custom budget if 'Custom' is selected")
|
||||
campaign_duration: Optional[str] = Field(None, description="How long the campaign will run")
|
||||
competitor_analysis: Optional[str] = Field(None, description="Information about competitor ads")
|
||||
brand_voice: Optional[str] = Field(None, description="Brand voice and tone guidelines")
|
||||
compliance_requirements: Optional[str] = Field(None, description="Any compliance or regulatory requirements")
|
||||
|
||||
|
||||
class AdCopyVariations(BaseModel):
|
||||
"""Different variations of ad copy."""
|
||||
headline_variations: List[str] = Field(..., description="Multiple headline options")
|
||||
primary_text_variations: List[str] = Field(..., description="Multiple primary text options")
|
||||
description_variations: List[str] = Field(..., description="Multiple description options")
|
||||
cta_variations: List[str] = Field(..., description="Multiple call-to-action options")
|
||||
|
||||
|
||||
class AdPerformancePredictions(BaseModel):
|
||||
"""Predicted ad performance metrics."""
|
||||
estimated_reach: str = Field(..., description="Estimated reach")
|
||||
estimated_ctr: str = Field(..., description="Estimated click-through rate")
|
||||
estimated_cpc: str = Field(..., description="Estimated cost per click")
|
||||
estimated_conversions: str = Field(..., description="Estimated conversions")
|
||||
optimization_score: str = Field(..., description="Overall optimization score")
|
||||
|
||||
|
||||
class FacebookAdCopyResponse(BaseModel):
|
||||
"""Response model for Facebook ad copy generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
primary_ad_copy: Optional[Dict[str, str]] = Field(None, description="Primary ad copy with headline, text, description")
|
||||
ad_variations: Optional[AdCopyVariations] = Field(None, description="Multiple variations for A/B testing")
|
||||
targeting_suggestions: Optional[List[str]] = Field(None, description="Additional targeting suggestions")
|
||||
creative_suggestions: Optional[List[str]] = Field(None, description="Creative and visual suggestions")
|
||||
performance_predictions: Optional[AdPerformancePredictions] = Field(None, description="Performance predictions")
|
||||
optimization_tips: Optional[List[str]] = Field(None, description="Optimization tips for better performance")
|
||||
compliance_notes: Optional[List[str]] = Field(None, description="Compliance and policy considerations")
|
||||
budget_recommendations: Optional[List[str]] = Field(None, description="Budget allocation recommendations")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
51
backend/api/facebook_writer/models/carousel_models.py
Normal file
51
backend/api/facebook_writer/models/carousel_models.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""Pydantic models for Facebook Carousel functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class CarouselType(str, Enum):
|
||||
"""Carousel type options."""
|
||||
PRODUCT_SHOWCASE = "Product showcase"
|
||||
STEP_BY_STEP = "Step-by-step guide"
|
||||
BEFORE_AFTER = "Before/After"
|
||||
TESTIMONIALS = "Customer testimonials"
|
||||
FEATURES_BENEFITS = "Features & Benefits"
|
||||
PORTFOLIO = "Portfolio showcase"
|
||||
EDUCATIONAL = "Educational content"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class CarouselSlide(BaseModel):
|
||||
"""Individual carousel slide content."""
|
||||
title: str = Field(..., description="Slide title")
|
||||
content: str = Field(..., description="Slide content/description")
|
||||
image_description: Optional[str] = Field(None, description="Description of the image for this slide")
|
||||
|
||||
|
||||
class FacebookCarouselRequest(BaseModel):
|
||||
"""Request model for Facebook carousel generation."""
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
carousel_type: CarouselType = Field(..., description="Type of carousel to create")
|
||||
custom_carousel_type: Optional[str] = Field(None, description="Custom carousel type if 'Custom' is selected")
|
||||
topic: str = Field(..., description="Main topic or theme of the carousel")
|
||||
num_slides: int = Field(default=5, ge=3, le=10, description="Number of slides (3-10)")
|
||||
include_cta: bool = Field(default=True, description="Include call-to-action in final slide")
|
||||
cta_text: Optional[str] = Field(None, description="Custom call-to-action text")
|
||||
brand_colors: Optional[str] = Field(None, description="Brand colors to mention for design")
|
||||
include: Optional[str] = Field(None, description="Elements to include")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid")
|
||||
|
||||
|
||||
class FacebookCarouselResponse(BaseModel):
|
||||
"""Response model for Facebook carousel generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
main_caption: Optional[str] = Field(None, description="Main caption for the carousel post")
|
||||
slides: Optional[List[CarouselSlide]] = Field(None, description="Generated carousel slides")
|
||||
design_suggestions: Optional[List[str]] = Field(None, description="Design and layout suggestions")
|
||||
hashtag_suggestions: Optional[List[str]] = Field(None, description="Hashtag suggestions")
|
||||
engagement_tips: Optional[List[str]] = Field(None, description="Engagement optimization tips")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
70
backend/api/facebook_writer/models/engagement_models.py
Normal file
70
backend/api/facebook_writer/models/engagement_models.py
Normal file
@@ -0,0 +1,70 @@
|
||||
"""Pydantic models for Facebook Engagement Analysis functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ContentType(str, Enum):
|
||||
"""Content type options for analysis."""
|
||||
POST = "Post"
|
||||
STORY = "Story"
|
||||
REEL = "Reel"
|
||||
CAROUSEL = "Carousel"
|
||||
VIDEO = "Video"
|
||||
IMAGE = "Image"
|
||||
LINK = "Link"
|
||||
|
||||
|
||||
class AnalysisType(str, Enum):
|
||||
"""Analysis type options."""
|
||||
CONTENT_ANALYSIS = "Content analysis"
|
||||
PERFORMANCE_PREDICTION = "Performance prediction"
|
||||
OPTIMIZATION_SUGGESTIONS = "Optimization suggestions"
|
||||
COMPETITOR_COMPARISON = "Competitor comparison"
|
||||
TREND_ANALYSIS = "Trend analysis"
|
||||
|
||||
|
||||
class FacebookEngagementRequest(BaseModel):
|
||||
"""Request model for Facebook engagement analysis."""
|
||||
content: str = Field(..., description="Content to analyze")
|
||||
content_type: ContentType = Field(..., description="Type of content being analyzed")
|
||||
analysis_type: AnalysisType = Field(..., description="Type of analysis to perform")
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
post_timing: Optional[str] = Field(None, description="When the content was/will be posted")
|
||||
hashtags: Optional[List[str]] = Field(None, description="Hashtags used with the content")
|
||||
competitor_content: Optional[str] = Field(None, description="Competitor content for comparison")
|
||||
historical_performance: Optional[Dict[str, Any]] = Field(None, description="Historical performance data")
|
||||
|
||||
|
||||
class EngagementMetrics(BaseModel):
|
||||
"""Engagement metrics and predictions."""
|
||||
predicted_reach: str = Field(..., description="Predicted reach")
|
||||
predicted_engagement_rate: str = Field(..., description="Predicted engagement rate")
|
||||
predicted_likes: str = Field(..., description="Predicted likes")
|
||||
predicted_comments: str = Field(..., description="Predicted comments")
|
||||
predicted_shares: str = Field(..., description="Predicted shares")
|
||||
virality_score: str = Field(..., description="Virality potential score")
|
||||
|
||||
|
||||
class OptimizationSuggestions(BaseModel):
|
||||
"""Content optimization suggestions."""
|
||||
content_improvements: List[str] = Field(..., description="Content improvement suggestions")
|
||||
timing_suggestions: List[str] = Field(..., description="Posting time optimization")
|
||||
hashtag_improvements: List[str] = Field(..., description="Hashtag optimization suggestions")
|
||||
visual_suggestions: List[str] = Field(..., description="Visual element suggestions")
|
||||
engagement_tactics: List[str] = Field(..., description="Engagement boosting tactics")
|
||||
|
||||
|
||||
class FacebookEngagementResponse(BaseModel):
|
||||
"""Response model for Facebook engagement analysis."""
|
||||
success: bool = Field(..., description="Whether the analysis was successful")
|
||||
content_score: Optional[float] = Field(None, description="Overall content quality score (0-100)")
|
||||
engagement_metrics: Optional[EngagementMetrics] = Field(None, description="Predicted engagement metrics")
|
||||
optimization_suggestions: Optional[OptimizationSuggestions] = Field(None, description="Optimization recommendations")
|
||||
sentiment_analysis: Optional[Dict[str, Any]] = Field(None, description="Content sentiment analysis")
|
||||
trend_alignment: Optional[Dict[str, Any]] = Field(None, description="Alignment with current trends")
|
||||
competitor_insights: Optional[Dict[str, Any]] = Field(None, description="Competitor comparison insights")
|
||||
error: Optional[str] = Field(None, description="Error message if analysis failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the analysis")
|
||||
61
backend/api/facebook_writer/models/event_models.py
Normal file
61
backend/api/facebook_writer/models/event_models.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""Pydantic models for Facebook Event functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class EventType(str, Enum):
|
||||
"""Event type options."""
|
||||
WORKSHOP = "Workshop"
|
||||
WEBINAR = "Webinar"
|
||||
CONFERENCE = "Conference"
|
||||
NETWORKING = "Networking event"
|
||||
PRODUCT_LAUNCH = "Product launch"
|
||||
SALE_PROMOTION = "Sale/Promotion"
|
||||
COMMUNITY = "Community event"
|
||||
EDUCATION = "Educational event"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class EventFormat(str, Enum):
|
||||
"""Event format options."""
|
||||
IN_PERSON = "In-person"
|
||||
VIRTUAL = "Virtual"
|
||||
HYBRID = "Hybrid"
|
||||
|
||||
|
||||
class FacebookEventRequest(BaseModel):
|
||||
"""Request model for Facebook event generation."""
|
||||
event_name: str = Field(..., description="Name of the event")
|
||||
event_type: EventType = Field(..., description="Type of event")
|
||||
custom_event_type: Optional[str] = Field(None, description="Custom event type if 'Custom' is selected")
|
||||
event_format: EventFormat = Field(..., description="Format of the event")
|
||||
business_type: str = Field(..., description="Type of business hosting the event")
|
||||
target_audience: str = Field(..., description="Target audience for the event")
|
||||
event_date: Optional[str] = Field(None, description="Event date (YYYY-MM-DD format)")
|
||||
event_time: Optional[str] = Field(None, description="Event time")
|
||||
location: Optional[str] = Field(None, description="Event location (physical address or virtual platform)")
|
||||
duration: Optional[str] = Field(None, description="Event duration")
|
||||
key_benefits: Optional[str] = Field(None, description="Key benefits or highlights of attending")
|
||||
speakers: Optional[str] = Field(None, description="Key speakers or presenters")
|
||||
agenda: Optional[str] = Field(None, description="Brief agenda or schedule")
|
||||
ticket_info: Optional[str] = Field(None, description="Ticket pricing and availability")
|
||||
special_offers: Optional[str] = Field(None, description="Special offers or early bird discounts")
|
||||
include: Optional[str] = Field(None, description="Additional elements to include")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid")
|
||||
|
||||
|
||||
class FacebookEventResponse(BaseModel):
|
||||
"""Response model for Facebook event generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
event_title: Optional[str] = Field(None, description="Generated event title")
|
||||
event_description: Optional[str] = Field(None, description="Generated event description")
|
||||
short_description: Optional[str] = Field(None, description="Short version for social media")
|
||||
key_highlights: Optional[List[str]] = Field(None, description="Key event highlights")
|
||||
call_to_action: Optional[str] = Field(None, description="Call-to-action text")
|
||||
hashtag_suggestions: Optional[List[str]] = Field(None, description="Hashtag suggestions")
|
||||
promotion_tips: Optional[List[str]] = Field(None, description="Event promotion tips")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
68
backend/api/facebook_writer/models/group_post_models.py
Normal file
68
backend/api/facebook_writer/models/group_post_models.py
Normal file
@@ -0,0 +1,68 @@
|
||||
"""Pydantic models for Facebook Group Post functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class GroupType(str, Enum):
|
||||
"""Group type options."""
|
||||
INDUSTRY = "Industry/Professional"
|
||||
HOBBY = "Hobby/Interest"
|
||||
LOCAL = "Local community"
|
||||
SUPPORT = "Support group"
|
||||
EDUCATIONAL = "Educational"
|
||||
BUSINESS = "Business networking"
|
||||
LIFESTYLE = "Lifestyle"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class PostPurpose(str, Enum):
|
||||
"""Post purpose in group."""
|
||||
SHARE_KNOWLEDGE = "Share knowledge"
|
||||
ASK_QUESTION = "Ask question"
|
||||
PROMOTE_BUSINESS = "Promote business"
|
||||
BUILD_RELATIONSHIPS = "Build relationships"
|
||||
PROVIDE_VALUE = "Provide value"
|
||||
SEEK_ADVICE = "Seek advice"
|
||||
ANNOUNCE_NEWS = "Announce news"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class GroupRules(BaseModel):
|
||||
"""Group rules and guidelines."""
|
||||
no_promotion: bool = Field(default=False, description="No promotion allowed")
|
||||
value_first: bool = Field(default=True, description="Must provide value first")
|
||||
no_links: bool = Field(default=False, description="No external links allowed")
|
||||
community_focused: bool = Field(default=True, description="Must be community-focused")
|
||||
relevant_only: bool = Field(default=True, description="Only relevant content allowed")
|
||||
|
||||
|
||||
class FacebookGroupPostRequest(BaseModel):
|
||||
"""Request model for Facebook group post generation."""
|
||||
group_name: str = Field(..., description="Name of the Facebook group")
|
||||
group_type: GroupType = Field(..., description="Type of group")
|
||||
custom_group_type: Optional[str] = Field(None, description="Custom group type if 'Custom' is selected")
|
||||
post_purpose: PostPurpose = Field(..., description="Purpose of the post")
|
||||
custom_purpose: Optional[str] = Field(None, description="Custom purpose if 'Custom' is selected")
|
||||
business_type: str = Field(..., description="Your business type")
|
||||
topic: str = Field(..., description="Main topic or subject of the post")
|
||||
target_audience: str = Field(..., description="Target audience within the group")
|
||||
value_proposition: str = Field(..., description="What value are you providing to the group")
|
||||
group_rules: GroupRules = Field(default_factory=GroupRules, description="Group rules to follow")
|
||||
include: Optional[str] = Field(None, description="Elements to include")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid")
|
||||
call_to_action: Optional[str] = Field(None, description="Desired call-to-action")
|
||||
|
||||
|
||||
class FacebookGroupPostResponse(BaseModel):
|
||||
"""Response model for Facebook group post generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
content: Optional[str] = Field(None, description="Generated group post content")
|
||||
engagement_starters: Optional[List[str]] = Field(None, description="Questions or prompts to encourage engagement")
|
||||
value_highlights: Optional[List[str]] = Field(None, description="Key value points highlighted in the post")
|
||||
community_guidelines: Optional[List[str]] = Field(None, description="How the post follows community guidelines")
|
||||
follow_up_suggestions: Optional[List[str]] = Field(None, description="Suggestions for follow-up engagement")
|
||||
relationship_building_tips: Optional[List[str]] = Field(None, description="Tips for building relationships in the group")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
54
backend/api/facebook_writer/models/hashtag_models.py
Normal file
54
backend/api/facebook_writer/models/hashtag_models.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""Pydantic models for Facebook Hashtag functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class HashtagPurpose(str, Enum):
|
||||
"""Hashtag purpose options."""
|
||||
BRAND_AWARENESS = "Brand awareness"
|
||||
ENGAGEMENT = "Engagement"
|
||||
REACH = "Reach expansion"
|
||||
COMMUNITY = "Community building"
|
||||
TREND = "Trend participation"
|
||||
PRODUCT_PROMOTION = "Product promotion"
|
||||
EVENT_PROMOTION = "Event promotion"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class HashtagCategory(str, Enum):
|
||||
"""Hashtag category options."""
|
||||
BRANDED = "Branded hashtags"
|
||||
TRENDING = "Trending hashtags"
|
||||
INDUSTRY = "Industry-specific"
|
||||
LOCATION = "Location-based"
|
||||
LIFESTYLE = "Lifestyle"
|
||||
COMMUNITY = "Community hashtags"
|
||||
|
||||
|
||||
class FacebookHashtagRequest(BaseModel):
|
||||
"""Request model for Facebook hashtag generation."""
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
industry: str = Field(..., description="Industry or niche")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
purpose: HashtagPurpose = Field(..., description="Purpose of the hashtags")
|
||||
custom_purpose: Optional[str] = Field(None, description="Custom purpose if 'Custom' is selected")
|
||||
content_topic: str = Field(..., description="Topic or theme of the content")
|
||||
location: Optional[str] = Field(None, description="Location if relevant for local hashtags")
|
||||
brand_name: Optional[str] = Field(None, description="Brand name for branded hashtags")
|
||||
campaign_name: Optional[str] = Field(None, description="Campaign name if applicable")
|
||||
hashtag_count: int = Field(default=10, ge=5, le=30, description="Number of hashtags to generate")
|
||||
include_categories: List[HashtagCategory] = Field(default_factory=list, description="Categories to include")
|
||||
|
||||
|
||||
class FacebookHashtagResponse(BaseModel):
|
||||
"""Response model for Facebook hashtag generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
hashtags: Optional[List[str]] = Field(None, description="Generated hashtags")
|
||||
categorized_hashtags: Optional[Dict[str, List[str]]] = Field(None, description="Hashtags organized by category")
|
||||
trending_hashtags: Optional[List[str]] = Field(None, description="Currently trending relevant hashtags")
|
||||
usage_tips: Optional[List[str]] = Field(None, description="Tips for using hashtags effectively")
|
||||
performance_predictions: Optional[Dict[str, str]] = Field(None, description="Predicted performance for different hashtag sets")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
80
backend/api/facebook_writer/models/page_about_models.py
Normal file
80
backend/api/facebook_writer/models/page_about_models.py
Normal file
@@ -0,0 +1,80 @@
|
||||
"""Pydantic models for Facebook Page About functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class BusinessCategory(str, Enum):
|
||||
"""Business category options."""
|
||||
RETAIL = "Retail"
|
||||
RESTAURANT = "Restaurant/Food"
|
||||
HEALTH_FITNESS = "Health & Fitness"
|
||||
EDUCATION = "Education"
|
||||
TECHNOLOGY = "Technology"
|
||||
CONSULTING = "Consulting"
|
||||
CREATIVE = "Creative Services"
|
||||
NONPROFIT = "Non-profit"
|
||||
ENTERTAINMENT = "Entertainment"
|
||||
REAL_ESTATE = "Real Estate"
|
||||
AUTOMOTIVE = "Automotive"
|
||||
BEAUTY = "Beauty & Personal Care"
|
||||
FINANCE = "Finance"
|
||||
TRAVEL = "Travel & Tourism"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class PageTone(str, Enum):
|
||||
"""Page tone options."""
|
||||
PROFESSIONAL = "Professional"
|
||||
FRIENDLY = "Friendly"
|
||||
INNOVATIVE = "Innovative"
|
||||
TRUSTWORTHY = "Trustworthy"
|
||||
CREATIVE = "Creative"
|
||||
APPROACHABLE = "Approachable"
|
||||
AUTHORITATIVE = "Authoritative"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class ContactInfo(BaseModel):
|
||||
"""Contact information for the page."""
|
||||
website: Optional[str] = Field(None, description="Website URL")
|
||||
phone: Optional[str] = Field(None, description="Phone number")
|
||||
email: Optional[str] = Field(None, description="Email address")
|
||||
address: Optional[str] = Field(None, description="Physical address")
|
||||
hours: Optional[str] = Field(None, description="Business hours")
|
||||
|
||||
|
||||
class FacebookPageAboutRequest(BaseModel):
|
||||
"""Request model for Facebook page about generation."""
|
||||
business_name: str = Field(..., description="Name of the business")
|
||||
business_category: BusinessCategory = Field(..., description="Category of business")
|
||||
custom_category: Optional[str] = Field(None, description="Custom category if 'Custom' is selected")
|
||||
business_description: str = Field(..., description="Brief description of what the business does")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
unique_value_proposition: str = Field(..., description="What makes the business unique")
|
||||
services_products: str = Field(..., description="Main services or products offered")
|
||||
company_history: Optional[str] = Field(None, description="Brief company history or founding story")
|
||||
mission_vision: Optional[str] = Field(None, description="Mission statement or vision")
|
||||
achievements: Optional[str] = Field(None, description="Key achievements or awards")
|
||||
page_tone: PageTone = Field(..., description="Desired tone for the page")
|
||||
custom_tone: Optional[str] = Field(None, description="Custom tone if 'Custom' is selected")
|
||||
contact_info: ContactInfo = Field(default_factory=ContactInfo, description="Contact information")
|
||||
keywords: Optional[str] = Field(None, description="Important keywords to include")
|
||||
call_to_action: Optional[str] = Field(None, description="Primary call-to-action")
|
||||
|
||||
|
||||
class FacebookPageAboutResponse(BaseModel):
|
||||
"""Response model for Facebook page about generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
short_description: Optional[str] = Field(None, description="Short description (under 155 characters)")
|
||||
long_description: Optional[str] = Field(None, description="Detailed about section")
|
||||
company_overview: Optional[str] = Field(None, description="Company overview section")
|
||||
mission_statement: Optional[str] = Field(None, description="Mission statement")
|
||||
story_section: Optional[str] = Field(None, description="Company story/history section")
|
||||
services_section: Optional[str] = Field(None, description="Services/products section")
|
||||
cta_suggestions: Optional[List[str]] = Field(None, description="Call-to-action suggestions")
|
||||
keyword_optimization: Optional[List[str]] = Field(None, description="SEO keyword suggestions")
|
||||
completion_tips: Optional[List[str]] = Field(None, description="Tips for completing the page")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
84
backend/api/facebook_writer/models/post_models.py
Normal file
84
backend/api/facebook_writer/models/post_models.py
Normal file
@@ -0,0 +1,84 @@
|
||||
"""Pydantic models for Facebook Post functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class PostGoal(str, Enum):
|
||||
"""Post goal options."""
|
||||
PROMOTE_PRODUCT = "Promote a product/service"
|
||||
SHARE_CONTENT = "Share valuable content"
|
||||
INCREASE_ENGAGEMENT = "Increase engagement"
|
||||
BUILD_AWARENESS = "Build brand awareness"
|
||||
DRIVE_TRAFFIC = "Drive website traffic"
|
||||
GENERATE_LEADS = "Generate leads"
|
||||
ANNOUNCE_NEWS = "Announce news/updates"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class PostTone(str, Enum):
|
||||
"""Post tone options."""
|
||||
INFORMATIVE = "Informative"
|
||||
HUMOROUS = "Humorous"
|
||||
INSPIRATIONAL = "Inspirational"
|
||||
UPBEAT = "Upbeat"
|
||||
CASUAL = "Casual"
|
||||
PROFESSIONAL = "Professional"
|
||||
CONVERSATIONAL = "Conversational"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class MediaType(str, Enum):
|
||||
"""Media type options."""
|
||||
NONE = "None"
|
||||
IMAGE = "Image"
|
||||
VIDEO = "Video"
|
||||
CAROUSEL = "Carousel"
|
||||
LINK_PREVIEW = "Link Preview"
|
||||
|
||||
|
||||
class AdvancedOptions(BaseModel):
|
||||
"""Advanced post generation options."""
|
||||
use_hook: bool = Field(default=True, description="Use attention-grabbing hook")
|
||||
use_story: bool = Field(default=True, description="Include storytelling elements")
|
||||
use_cta: bool = Field(default=True, description="Add clear call-to-action")
|
||||
use_question: bool = Field(default=True, description="Include engagement question")
|
||||
use_emoji: bool = Field(default=True, description="Use relevant emojis")
|
||||
use_hashtags: bool = Field(default=True, description="Add relevant hashtags")
|
||||
|
||||
|
||||
class FacebookPostRequest(BaseModel):
|
||||
"""Request model for Facebook post generation."""
|
||||
business_type: str = Field(..., description="Type of business (e.g., 'Fitness coach')")
|
||||
target_audience: str = Field(..., description="Target audience description (e.g., 'Fitness enthusiasts aged 25-35')")
|
||||
post_goal: PostGoal = Field(..., description="Main goal of the post")
|
||||
custom_goal: Optional[str] = Field(None, description="Custom goal if 'Custom' is selected")
|
||||
post_tone: PostTone = Field(..., description="Tone of the post")
|
||||
custom_tone: Optional[str] = Field(None, description="Custom tone if 'Custom' is selected")
|
||||
include: Optional[str] = Field(None, description="Elements to include in the post")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid in the post")
|
||||
media_type: MediaType = Field(default=MediaType.NONE, description="Type of media to include")
|
||||
advanced_options: AdvancedOptions = Field(default_factory=AdvancedOptions, description="Advanced generation options")
|
||||
|
||||
|
||||
class FacebookPostAnalytics(BaseModel):
|
||||
"""Analytics predictions for the generated post."""
|
||||
expected_reach: str = Field(..., description="Expected reach range")
|
||||
expected_engagement: str = Field(..., description="Expected engagement percentage")
|
||||
best_time_to_post: str = Field(..., description="Optimal posting time")
|
||||
|
||||
|
||||
class FacebookPostOptimization(BaseModel):
|
||||
"""Optimization suggestions for the post."""
|
||||
suggestions: List[str] = Field(..., description="List of optimization suggestions")
|
||||
|
||||
|
||||
class FacebookPostResponse(BaseModel):
|
||||
"""Response model for Facebook post generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
content: Optional[str] = Field(None, description="Generated post content")
|
||||
analytics: Optional[FacebookPostAnalytics] = Field(None, description="Analytics predictions")
|
||||
optimization: Optional[FacebookPostOptimization] = Field(None, description="Optimization suggestions")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
61
backend/api/facebook_writer/models/reel_models.py
Normal file
61
backend/api/facebook_writer/models/reel_models.py
Normal file
@@ -0,0 +1,61 @@
|
||||
"""Pydantic models for Facebook Reel functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ReelType(str, Enum):
|
||||
"""Reel type options."""
|
||||
PRODUCT_DEMO = "Product demonstration"
|
||||
TUTORIAL = "Tutorial/How-to"
|
||||
ENTERTAINMENT = "Entertainment"
|
||||
EDUCATIONAL = "Educational"
|
||||
TREND_BASED = "Trend-based"
|
||||
BEHIND_SCENES = "Behind the scenes"
|
||||
USER_GENERATED = "User-generated content"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class ReelLength(str, Enum):
|
||||
"""Reel length options."""
|
||||
SHORT = "15-30 seconds"
|
||||
MEDIUM = "30-60 seconds"
|
||||
LONG = "60-90 seconds"
|
||||
|
||||
|
||||
class ReelStyle(str, Enum):
|
||||
"""Reel style options."""
|
||||
FAST_PACED = "Fast-paced"
|
||||
RELAXED = "Relaxed"
|
||||
DRAMATIC = "Dramatic"
|
||||
MINIMALIST = "Minimalist"
|
||||
VIBRANT = "Vibrant"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class FacebookReelRequest(BaseModel):
|
||||
"""Request model for Facebook reel generation."""
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
reel_type: ReelType = Field(..., description="Type of reel to create")
|
||||
custom_reel_type: Optional[str] = Field(None, description="Custom reel type if 'Custom' is selected")
|
||||
reel_length: ReelLength = Field(..., description="Desired length of the reel")
|
||||
reel_style: ReelStyle = Field(..., description="Style of the reel")
|
||||
custom_style: Optional[str] = Field(None, description="Custom style if 'Custom' is selected")
|
||||
topic: str = Field(..., description="Main topic or focus of the reel")
|
||||
include: Optional[str] = Field(None, description="Elements to include in the reel")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid in the reel")
|
||||
music_preference: Optional[str] = Field(None, description="Music style preference")
|
||||
|
||||
|
||||
class FacebookReelResponse(BaseModel):
|
||||
"""Response model for Facebook reel generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
script: Optional[str] = Field(None, description="Generated reel script")
|
||||
scene_breakdown: Optional[List[str]] = Field(None, description="Scene-by-scene breakdown")
|
||||
music_suggestions: Optional[List[str]] = Field(None, description="Music suggestions")
|
||||
hashtag_suggestions: Optional[List[str]] = Field(None, description="Hashtag suggestions")
|
||||
engagement_tips: Optional[List[str]] = Field(None, description="Engagement optimization tips")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
84
backend/api/facebook_writer/models/story_models.py
Normal file
84
backend/api/facebook_writer/models/story_models.py
Normal file
@@ -0,0 +1,84 @@
|
||||
"""Pydantic models for Facebook Story functionality."""
|
||||
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class StoryType(str, Enum):
|
||||
"""Story type options."""
|
||||
PRODUCT_SHOWCASE = "Product showcase"
|
||||
BEHIND_SCENES = "Behind the scenes"
|
||||
USER_TESTIMONIAL = "User testimonial"
|
||||
EVENT_PROMOTION = "Event promotion"
|
||||
TUTORIAL = "Tutorial/How-to"
|
||||
QUESTION_POLL = "Question/Poll"
|
||||
ANNOUNCEMENT = "Announcement"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class StoryTone(str, Enum):
|
||||
"""Story tone options."""
|
||||
CASUAL = "Casual"
|
||||
FUN = "Fun"
|
||||
PROFESSIONAL = "Professional"
|
||||
INSPIRATIONAL = "Inspirational"
|
||||
EDUCATIONAL = "Educational"
|
||||
ENTERTAINING = "Entertaining"
|
||||
CUSTOM = "Custom"
|
||||
|
||||
|
||||
class StoryVisualOptions(BaseModel):
|
||||
"""Visual options for story."""
|
||||
# Background layer
|
||||
background_type: str = Field(default="Solid color", description="Background type (Solid color, Gradient, Image, Video)")
|
||||
background_image_prompt: Optional[str] = Field(None, description="If background_type is Image/Video, describe desired visual")
|
||||
gradient_style: Optional[str] = Field(None, description="Gradient style if gradient background is chosen")
|
||||
|
||||
# Text overlay styling
|
||||
text_overlay: bool = Field(default=True, description="Include text overlay")
|
||||
text_style: Optional[str] = Field(None, description="Headline/Subtext style, e.g., Bold, Minimal, Handwritten")
|
||||
text_color: Optional[str] = Field(None, description="Preferred text color or palette")
|
||||
text_position: Optional[str] = Field(None, description="Top/Center/Bottom; Left/Center/Right")
|
||||
|
||||
# Embellishments and interactivity
|
||||
stickers: bool = Field(default=True, description="Use stickers/emojis")
|
||||
interactive_elements: bool = Field(default=True, description="Include polls/questions")
|
||||
interactive_types: Optional[List[str]] = Field(
|
||||
default=None,
|
||||
description="List of interactive types like ['poll','quiz','slider','countdown']"
|
||||
)
|
||||
|
||||
# CTA overlay
|
||||
call_to_action: Optional[str] = Field(None, description="Optional CTA copy to place on story")
|
||||
|
||||
|
||||
class FacebookStoryRequest(BaseModel):
|
||||
"""Request model for Facebook story generation."""
|
||||
business_type: str = Field(..., description="Type of business")
|
||||
target_audience: str = Field(..., description="Target audience description")
|
||||
story_type: StoryType = Field(..., description="Type of story to create")
|
||||
custom_story_type: Optional[str] = Field(None, description="Custom story type if 'Custom' is selected")
|
||||
story_tone: StoryTone = Field(..., description="Tone of the story")
|
||||
custom_tone: Optional[str] = Field(None, description="Custom tone if 'Custom' is selected")
|
||||
include: Optional[str] = Field(None, description="Elements to include in the story")
|
||||
avoid: Optional[str] = Field(None, description="Elements to avoid in the story")
|
||||
visual_options: StoryVisualOptions = Field(default_factory=StoryVisualOptions, description="Visual customization options")
|
||||
# Advanced text generation options (parity with original Streamlit module)
|
||||
use_hook: bool = Field(default=True, description="Start with a hook to grab attention")
|
||||
use_story: bool = Field(default=True, description="Use a short narrative arc")
|
||||
use_cta: bool = Field(default=True, description="Include a call to action")
|
||||
use_question: bool = Field(default=True, description="Ask a question to spur interaction")
|
||||
use_emoji: bool = Field(default=True, description="Use emojis where appropriate")
|
||||
use_hashtags: bool = Field(default=True, description="Include relevant hashtags in copy")
|
||||
|
||||
|
||||
class FacebookStoryResponse(BaseModel):
|
||||
"""Response model for Facebook story generation."""
|
||||
success: bool = Field(..., description="Whether the generation was successful")
|
||||
content: Optional[str] = Field(None, description="Generated story content")
|
||||
images_base64: Optional[List[str]] = Field(None, description="List of base64-encoded story images (PNG)")
|
||||
visual_suggestions: Optional[List[str]] = Field(None, description="Visual element suggestions")
|
||||
engagement_tips: Optional[List[str]] = Field(None, description="Engagement optimization tips")
|
||||
error: Optional[str] = Field(None, description="Error message if generation failed")
|
||||
metadata: Optional[Dict[str, Any]] = Field(None, description="Additional metadata about the generation")
|
||||
Reference in New Issue
Block a user