爆款和拆镜error消息正则中文

This commit is contained in:
2026-07-24 15:56:15 +08:00
parent 663c4fa9db
commit bc7eee681d
2 changed files with 20 additions and 2 deletions
@@ -370,6 +370,15 @@ async def _soft_delete_steps_from_index(
def _step_to_out(step: ModuleGenerationStep) -> HotOpeningStepOut: 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
match = re.search(r"code='([^']+)'", error_message)
if match:
code = match.group(1)
if code in ARK_ERRORS:
error_message = ARK_ERRORS[code]
return HotOpeningStepOut( return HotOpeningStepOut(
id=step.id, id=step.id,
project_id=step.project_id, project_id=step.project_id,
@@ -384,7 +393,7 @@ def _step_to_out(step: ModuleGenerationStep) -> HotOpeningStepOut:
chat_task_id=step.chat_task_id, chat_task_id=step.chat_task_id,
input=_parse_json(step.input_json, {}), input=_parse_json(step.input_json, {}),
output=_parse_json(step.output_json, {}), output=_parse_json(step.output_json, {}),
error_message=step.error_message, error_message=error_message,
created_at=step.created_at, created_at=step.created_at,
updated_at=step.updated_at, updated_at=step.updated_at,
completed_at=step.completed_at, completed_at=step.completed_at,
@@ -381,6 +381,15 @@ async def _soft_delete_steps_from_index(
def _step_to_out(step: ModuleGenerationStep) -> ShotReplicateStepOut: 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
match = re.search(r"code='([^']+)'", error_message)
if match:
code = match.group(1)
if code in ARK_ERRORS:
error_message = ARK_ERRORS[code]
return ShotReplicateStepOut( return ShotReplicateStepOut(
id=step.id, id=step.id,
project_id=step.project_id, project_id=step.project_id,
@@ -395,7 +404,7 @@ def _step_to_out(step: ModuleGenerationStep) -> ShotReplicateStepOut:
chat_task_id=step.chat_task_id, chat_task_id=step.chat_task_id,
input=_parse_json(step.input_json, {}), input=_parse_json(step.input_json, {}),
output=_parse_json(step.output_json, {}), output=_parse_json(step.output_json, {}),
error_message=step.error_message, error_message=error_message,
created_at=step.created_at, created_at=step.created_at,
updated_at=step.updated_at, updated_at=step.updated_at,
completed_at=step.completed_at, completed_at=step.completed_at,