Post Typen Verwalten + Strategy weight

This commit is contained in:
2026-02-14 14:48:03 +01:00
parent 1ebf50ab04
commit 31150000fd
14 changed files with 2624 additions and 43 deletions

View File

@@ -342,11 +342,13 @@ class WorkflowOrchestrator:
# Get post type context if specified
post_type = None
post_type_analysis = None
strategy_weight = 0.5 # Default strategy weight
if post_type_id:
post_type = await db.get_post_type(post_type_id)
if post_type:
post_type_analysis = post_type.analysis
logger.info(f"Targeting research for post type: {post_type.name}")
strategy_weight = post_type.strategy_weight
logger.info(f"Targeting research for post type: {post_type.name} with strategy weight {strategy_weight:.1f}")
def report_progress(message: str, step: int, total: int = 4):
if progress_callback:
@@ -358,6 +360,15 @@ class WorkflowOrchestrator:
if not profile_analysis:
raise ValueError("Profile analysis not found. Run initial setup first.")
# Step 1.5: Load company strategy if user belongs to a company
company_strategy = None
profile = await db.get_profile(user_id)
if profile and profile.company_id:
company = await db.get_company(profile.company_id)
if company and company.company_strategy:
company_strategy = company.company_strategy
logger.info(f"Loaded company strategy for research: {company.name}")
# Step 2: Get ALL existing topics (from multiple sources to avoid repetition)
report_progress("Lade existierende Topics...", 2)
existing_topics = set()
@@ -384,9 +395,6 @@ class WorkflowOrchestrator:
existing_topics = list(existing_topics)
logger.info(f"Found {len(existing_topics)} existing topics to avoid")
# Get profile data
profile = await db.get_profile(user_id)
# Get example posts to understand the person's actual content style
# If post_type_id is specified, only use posts of that type
if post_type_id:
@@ -409,7 +417,9 @@ class WorkflowOrchestrator:
customer_data=profile.metadata,
example_posts=example_post_texts,
post_type=post_type,
post_type_analysis=post_type_analysis
post_type_analysis=post_type_analysis,
company_strategy=company_strategy,
strategy_weight=strategy_weight
)
# Step 4: Save research results
@@ -582,11 +592,14 @@ class WorkflowOrchestrator:
# Get post type info if specified
post_type = None
post_type_analysis = None
strategy_weight = 0.5 # Default strategy weight
if post_type_id:
post_type = await db.get_post_type(post_type_id)
if post_type and post_type.analysis:
post_type_analysis = post_type.analysis
logger.info(f"Using post type '{post_type.name}' for writing")
if post_type:
if post_type.analysis:
post_type_analysis = post_type.analysis
strategy_weight = post_type.strategy_weight # Extract strategy weight from post type
logger.info(f"Using post type '{post_type.name}' with strategy weight {strategy_weight:.1f}")
# Load user's real posts as style examples
# If post_type_id is specified, only use posts of that type
@@ -642,7 +655,8 @@ class WorkflowOrchestrator:
post_type_analysis=post_type_analysis,
user_thoughts=user_thoughts,
selected_hook=selected_hook,
company_strategy=company_strategy # NEW: Pass company strategy
company_strategy=company_strategy, # Pass company strategy
strategy_weight=strategy_weight # NEW: Pass strategy weight
)
else:
# Revision based on feedback - pass full critic result for structured changes
@@ -660,7 +674,8 @@ class WorkflowOrchestrator:
post_type_analysis=post_type_analysis,
user_thoughts=user_thoughts,
selected_hook=selected_hook,
company_strategy=company_strategy # NEW: Pass company strategy
company_strategy=company_strategy, # Pass company strategy
strategy_weight=strategy_weight # NEW: Pass strategy weight
)
writer_versions.append(current_post)