|
@@ -66,11 +66,12 @@ def _create_pattern_task(scene: SceneEnum, content_type: ContentTypeEnum) -> Opt
|
|
|
return None
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
-def _save_pattern_contents(task_id: str, contents: List[ContentParam]) -> bool:
|
|
|
|
|
|
|
+def _save_pattern_contents(task_id: str, pattern_name: str, contents: List[ContentParam]) -> bool:
|
|
|
"""将聚类内容写入 workflow_pattern_task_content 表"""
|
|
"""将聚类内容写入 workflow_pattern_task_content 表"""
|
|
|
sql = """
|
|
sql = """
|
|
|
INSERT INTO workflow_pattern_task_content (
|
|
INSERT INTO workflow_pattern_task_content (
|
|
|
task_id,
|
|
task_id,
|
|
|
|
|
+ pattern_name,
|
|
|
channel_content_id,
|
|
channel_content_id,
|
|
|
images,
|
|
images,
|
|
|
title,
|
|
title,
|
|
@@ -79,7 +80,7 @@ def _save_pattern_contents(task_id: str, contents: List[ContentParam]) -> bool:
|
|
|
body_text,
|
|
body_text,
|
|
|
video_url,
|
|
video_url,
|
|
|
weight_score
|
|
weight_score
|
|
|
- ) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
|
|
|
|
|
+ ) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
for content in contents:
|
|
for content in contents:
|
|
@@ -87,6 +88,7 @@ def _save_pattern_contents(task_id: str, contents: List[ContentParam]) -> bool:
|
|
|
images_str = json.dumps(content.images or []) if isinstance(content.images, list) else ""
|
|
images_str = json.dumps(content.images or []) if isinstance(content.images, list) else ""
|
|
|
params = (
|
|
params = (
|
|
|
task_id,
|
|
task_id,
|
|
|
|
|
+ pattern_name,
|
|
|
content.channel_content_id,
|
|
content.channel_content_id,
|
|
|
images_str,
|
|
images_str,
|
|
|
content.title,
|
|
content.title,
|
|
@@ -181,7 +183,7 @@ def begin_pattern_task(param: PatternContentParam) -> Dict[str, Any]:
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# 3. 将内容写入 workflow_pattern_task_content 表
|
|
# 3. 将内容写入 workflow_pattern_task_content 表
|
|
|
- if not _save_pattern_contents(task.task_id, param.contents):
|
|
|
|
|
|
|
+ if not _save_pattern_contents(task.task_id, param.pattern_name, param.contents):
|
|
|
return _build_error_response(
|
|
return _build_error_response(
|
|
|
ERROR_CODE_FAILED,
|
|
ERROR_CODE_FAILED,
|
|
|
"写入聚类内容失败",
|
|
"写入聚类内容失败",
|