|
|
@@ -1,4 +1,4 @@
|
|
|
-from utils.params import DecodeContentParam, SceneEnum, ContentTypeEnum, CapabilityEnum
|
|
|
+from utils.params import DecodeContentParam, SceneEnum, ContentTypeEnum, CapabilityEnum, ContentParam
|
|
|
from models.task import WorkflowTask
|
|
|
from models.decode_task_result import WorkflowDecodeTaskResult
|
|
|
from utils.sync_mysql_help import mysql
|
|
|
@@ -53,12 +53,17 @@ def _create_workflow_task(scene: SceneEnum, content_type: ContentTypeEnum) -> Op
|
|
|
return None
|
|
|
|
|
|
|
|
|
-def _initialize_task_result(task_id: str, content) -> Optional[WorkflowDecodeTaskResult]:
|
|
|
+def _initialize_task_result(
|
|
|
+ task_id: str,
|
|
|
+ content: ContentParam,
|
|
|
+ content_type: ContentTypeEnum
|
|
|
+) -> Optional[WorkflowDecodeTaskResult]:
|
|
|
"""初始化选题解构任务结果(`content` 中 title、images、merge_leve2 等字段一并写入 workflow_decode_task_result)。"""
|
|
|
try:
|
|
|
result = WorkflowDecodeTaskResult.create_result(
|
|
|
task_id=task_id,
|
|
|
- content=content
|
|
|
+ content=content,
|
|
|
+ content_type=content_type
|
|
|
)
|
|
|
logger.info(f"初始化任务结果成功,task_id: {task_id}")
|
|
|
return result
|
|
|
@@ -67,12 +72,17 @@ def _initialize_task_result(task_id: str, content) -> Optional[WorkflowDecodeTas
|
|
|
return None
|
|
|
|
|
|
|
|
|
-def _initialize_script_task_result(task_id: str, content) -> Optional[WorkflowDecodeTaskResult]:
|
|
|
+def _initialize_script_task_result(
|
|
|
+ task_id: str,
|
|
|
+ content: ContentParam,
|
|
|
+ content_type: ContentTypeEnum
|
|
|
+) -> Optional[WorkflowDecodeTaskResult]:
|
|
|
"""初始化创作解构任务结果(`content` 含 merge_leve2 等字段,写入 workflow_script_task_result)"""
|
|
|
try:
|
|
|
result = WorkflowDecodeTaskResult.create_result(
|
|
|
task_id=task_id,
|
|
|
content=content,
|
|
|
+ content_type=content_type,
|
|
|
table_name="workflow_script_task_result",
|
|
|
)
|
|
|
logger.info(f"初始化创作解构任务结果成功,task_id: {task_id}")
|
|
|
@@ -182,7 +192,7 @@ def decode_topic(param: DecodeContentParam) -> Dict[str, Any]:
|
|
|
)
|
|
|
|
|
|
# 步骤2: 初始化任务结果(merge_leve2 与 title/images 等同属 content,由 create_result 落库)
|
|
|
- result = _initialize_task_result(task.task_id, param.content)
|
|
|
+ result = _initialize_task_result(task.task_id, param.content, param.content_type)
|
|
|
if not result or not result.task_id:
|
|
|
return _build_error_response(
|
|
|
ERROR_CODE_FAILED,
|
|
|
@@ -235,7 +245,7 @@ def decode_creation(param: DecodeContentParam) -> Dict[str, Any]:
|
|
|
)
|
|
|
|
|
|
# 步骤2: 初始化创作解构任务结果(merge_leve2 等同 content 字段一并落库)
|
|
|
- result = _initialize_script_task_result(task.task_id, param.content)
|
|
|
+ result = _initialize_script_task_result(task.task_id, param.content, param.content_type)
|
|
|
if not result or not result.task_id:
|
|
|
return _build_error_response(
|
|
|
ERROR_CODE_FAILED,
|