Enforce content status to 'draft' for newly generated content in GenerateContentFunction
- Updated GenerateContentFunction to ensure that the content status is always set to 'draft' upon creation. - Clarified that the status can only be changed manually to 'review' or 'published', reinforcing the status management logic.
This commit is contained in:
@@ -197,7 +197,9 @@ class GenerateContentFunction(BaseAIFunction):
|
|||||||
secondary_keywords = parsed.get('secondary_keywords', [])
|
secondary_keywords = parsed.get('secondary_keywords', [])
|
||||||
tags = parsed.get('tags', [])
|
tags = parsed.get('tags', [])
|
||||||
categories = parsed.get('categories', [])
|
categories = parsed.get('categories', [])
|
||||||
content_status = parsed.get('status', 'draft')
|
# Content status should always be 'draft' for newly generated content
|
||||||
|
# Status can only be changed manually to 'review' or 'published'
|
||||||
|
content_status = 'draft'
|
||||||
else:
|
else:
|
||||||
# Plain text response (legacy)
|
# Plain text response (legacy)
|
||||||
content_html = str(parsed)
|
content_html = str(parsed)
|
||||||
@@ -256,7 +258,9 @@ class GenerateContentFunction(BaseAIFunction):
|
|||||||
else:
|
else:
|
||||||
content_record.categories = []
|
content_record.categories = []
|
||||||
|
|
||||||
content_record.status = content_status or 'draft'
|
# Always set status to 'draft' for newly generated content
|
||||||
|
# Status can only be: draft, review, published (changed manually)
|
||||||
|
content_record.status = 'draft'
|
||||||
|
|
||||||
# Merge any extra fields into metadata (non-standard keys)
|
# Merge any extra fields into metadata (non-standard keys)
|
||||||
if isinstance(parsed, dict):
|
if isinstance(parsed, dict):
|
||||||
|
|||||||
Reference in New Issue
Block a user