视频提示SCHEMA管理后台配置联动修改三端
This commit is contained in:
@@ -87,7 +87,7 @@ from app.services.module_generation_step_update_service import (
|
||||
update_module_video_prompt_schema,
|
||||
)
|
||||
from app.services.resource_signed_url_service import build_resource_signed_url
|
||||
from app.services.video_prompt_schema_config_service import get_runtime_schema_snapshot
|
||||
from app.services.video_prompt_schema_config_service import fallback_runtime_schema_snapshot, get_runtime_schema_snapshot
|
||||
from app.utils.id_gen import generate_id
|
||||
from app.models.shot_replicate_segment import ShotReplicateSegment
|
||||
from app.enums.shot_replicate import ShotSegmentReplicateStatusEnum, ShotSplitStatusEnum
|
||||
@@ -187,6 +187,29 @@ def _unwrap_step_output(value: Any) -> dict[str, Any]:
|
||||
return _common_unwrap_step_output(value, schema_version=STEP_IO_SCHEMA_VERSION)
|
||||
|
||||
|
||||
def _resolve_video_schema_config_snapshot(video_prompt_output: dict[str, Any]) -> tuple[dict[str, Any] | None, str | None, str | None, bool]:
|
||||
"""
|
||||
详情接口运行时补齐历史第4步缺失的 schema_config_snapshot。
|
||||
|
||||
注意:这里仅用于接口返回,不修改 step.output_json,避免把历史脏数据伪装成生成当时真实快照。
|
||||
"""
|
||||
prompt_schema = video_prompt_output.get("prompt_schema")
|
||||
if not isinstance(prompt_schema, dict) or not prompt_schema:
|
||||
return None, None, None, False
|
||||
|
||||
raw_snapshot = video_prompt_output.get("schema_config_snapshot")
|
||||
has_real_snapshot = isinstance(raw_snapshot, dict) and isinstance(raw_snapshot.get("data"), dict)
|
||||
snapshot = fallback_runtime_schema_snapshot(raw_snapshot if has_real_snapshot else None)
|
||||
return (
|
||||
snapshot,
|
||||
str(snapshot.get("source") or video_prompt_output.get("schema_config_source") or "") or None,
|
||||
str(snapshot.get("version") or video_prompt_output.get("schema_config_version") or "") or None,
|
||||
not has_real_snapshot,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
async def log_module_event(
|
||||
db: AsyncSession,
|
||||
*,
|
||||
@@ -382,6 +405,8 @@ async def project_to_detail_out(db: AsyncSession, project: ModuleGenerationProje
|
||||
video_url = video_generate_output.get("result_video_url") or (video_chat.video_url if video_chat else None) or project.final_video_url
|
||||
cover_url = video_generate_output.get("result_video_cover_url") or (video_chat.video_cover_url if video_chat else None) or project.final_video_cover_url
|
||||
|
||||
schema_config_snapshot, schema_config_source, schema_config_version, schema_config_is_fallback = _resolve_video_schema_config_snapshot(video_prompt_output)
|
||||
|
||||
user_name: str | None = None
|
||||
if project.user_id:
|
||||
user_result = await db.execute(select(User.username).where(User.id == project.user_id).limit(1))
|
||||
@@ -426,9 +451,10 @@ async def project_to_detail_out(db: AsyncSession, project: ModuleGenerationProje
|
||||
prompt_schema=video_prompt_output.get("prompt_schema"),
|
||||
final_prompt=video_prompt_output.get("final_prompt"),
|
||||
prompt_params=video_prompt_output.get("params_used_for_prompt") or video_prompt_input.get("video_config"),
|
||||
schema_config_snapshot=video_prompt_output.get("schema_config_snapshot"),
|
||||
schema_config_source=video_prompt_output.get("schema_config_source"),
|
||||
schema_config_version=video_prompt_output.get("schema_config_version"),
|
||||
schema_config_snapshot=schema_config_snapshot,
|
||||
schema_config_source=schema_config_source,
|
||||
schema_config_version=schema_config_version,
|
||||
schema_config_is_fallback=schema_config_is_fallback,
|
||||
engine_id=video_snapshot.get("id") or video_generate_input.get("engine_id"),
|
||||
engine_name=video_snapshot.get("name") or video_generate_input.get("engine_name"),
|
||||
params=video_generate_input.get("params") or video_generate_input,
|
||||
|
||||
Reference in New Issue
Block a user