Merge branch 'main' of https://gitee.com/wg123/video-gen
This commit is contained in:
@@ -370,6 +370,16 @@ async def _soft_delete_steps_from_index(
|
||||
|
||||
|
||||
def _step_to_out(step: ModuleGenerationStep) -> HotOpeningStepOut:
|
||||
error_message = step.error_message
|
||||
if error_message:
|
||||
from app.services.error_codes import ARK_ERRORS
|
||||
import re
|
||||
# 兼容两种格式: code='xxx' 或 'code': 'xxx'
|
||||
match = re.search(r"""code['"]?\s*[:=]\s*['"]([^'"]+)['"]""", error_message)
|
||||
if match:
|
||||
code = match.group(1)
|
||||
if code in ARK_ERRORS:
|
||||
error_message = ARK_ERRORS[code]
|
||||
return HotOpeningStepOut(
|
||||
id=step.id,
|
||||
project_id=step.project_id,
|
||||
@@ -384,7 +394,7 @@ def _step_to_out(step: ModuleGenerationStep) -> HotOpeningStepOut:
|
||||
chat_task_id=step.chat_task_id,
|
||||
input=_parse_json(step.input_json, {}),
|
||||
output=_parse_json(step.output_json, {}),
|
||||
error_message=step.error_message,
|
||||
error_message=error_message,
|
||||
created_at=step.created_at,
|
||||
updated_at=step.updated_at,
|
||||
completed_at=step.completed_at,
|
||||
|
||||
@@ -381,6 +381,16 @@ async def _soft_delete_steps_from_index(
|
||||
|
||||
|
||||
def _step_to_out(step: ModuleGenerationStep) -> ShotReplicateStepOut:
|
||||
error_message = step.error_message
|
||||
if error_message:
|
||||
from app.services.error_codes import ARK_ERRORS
|
||||
import re
|
||||
# 兼容两种格式: code='xxx' 或 'code': 'xxx'
|
||||
match = re.search(r"""code['"]?\s*[:=]\s*['"]([^'"]+)['"]""", error_message)
|
||||
if match:
|
||||
code = match.group(1)
|
||||
if code in ARK_ERRORS:
|
||||
error_message = ARK_ERRORS[code]
|
||||
return ShotReplicateStepOut(
|
||||
id=step.id,
|
||||
project_id=step.project_id,
|
||||
@@ -395,7 +405,7 @@ def _step_to_out(step: ModuleGenerationStep) -> ShotReplicateStepOut:
|
||||
chat_task_id=step.chat_task_id,
|
||||
input=_parse_json(step.input_json, {}),
|
||||
output=_parse_json(step.output_json, {}),
|
||||
error_message=step.error_message,
|
||||
error_message=error_message,
|
||||
created_at=step.created_at,
|
||||
updated_at=step.updated_at,
|
||||
completed_at=step.completed_at,
|
||||
|
||||
Reference in New Issue
Block a user