feat: Phase B learning + hashtag profiles Pro-only lock
- Approve action saves post as reference example in character's content_rules - Keep last 5 approved examples per character (auto-rotating) - Inject last 3 approved examples as few-shot in LLM system prompt - Lock YouTube/TikTok hashtag profile tabs for Freemium users (Pro only) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -315,12 +315,28 @@ def approve_post(
|
||||
db: Session = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Approve a post (set status to 'approved')."""
|
||||
"""Approve a post (set status to 'approved'). Also saves it as a reference example for the character."""
|
||||
post = db.query(Post).filter(Post.id == post_id, Post.user_id == current_user.id).first()
|
||||
if not post:
|
||||
raise HTTPException(status_code=404, detail="Post not found")
|
||||
post.status = "approved"
|
||||
post.updated_at = datetime.utcnow()
|
||||
|
||||
# Save as reference example for future few-shot learning (keep last 5 per character)
|
||||
if post.text_content and post.character_id:
|
||||
character = db.query(Character).filter(Character.id == post.character_id).first()
|
||||
if character:
|
||||
examples = character.content_rules or {}
|
||||
approved_examples = examples.get("approved_examples", [])
|
||||
approved_examples.append({
|
||||
"platform": post.platform_hint or "general",
|
||||
"text": post.text_content[:500], # truncate for prompt efficiency
|
||||
})
|
||||
# Keep only last 5
|
||||
examples["approved_examples"] = approved_examples[-5:]
|
||||
character.content_rules = examples
|
||||
character.updated_at = datetime.utcnow()
|
||||
|
||||
db.commit()
|
||||
db.refresh(post)
|
||||
return post
|
||||
|
||||
Reference in New Issue
Block a user