视频提词优化管理后台配置
This commit is contained in:
@@ -87,6 +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.utils.id_gen import generate_id
|
||||
from app.models.shot_replicate_segment import ShotReplicateSegment
|
||||
from app.enums.shot_replicate import ShotSegmentReplicateStatusEnum, ShotSplitStatusEnum
|
||||
@@ -425,6 +426,9 @@ 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"),
|
||||
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,
|
||||
@@ -1070,6 +1074,8 @@ async def run_video_prompt_optimize(db: AsyncSession, *, project_id: str, step_i
|
||||
prompt_type=ModulePromptTypeEnum.VIDEO_PROMPT.value,
|
||||
request=request_log,
|
||||
)
|
||||
schema_config_snapshot = await get_runtime_schema_snapshot(db)
|
||||
request_log["schema_config_source"] = schema_config_snapshot.get("source")
|
||||
prompt_schema, final_prompt, token_usage = await optimize_shot_replicate_video_prompt(
|
||||
db,
|
||||
user_id=project.user_id,
|
||||
@@ -1080,6 +1086,7 @@ async def run_video_prompt_optimize(db: AsyncSession, *, project_id: str, step_i
|
||||
generated_image_url=generated_image_url,
|
||||
video_config=video_config,
|
||||
target_platform=target_platform,
|
||||
schema_config_snapshot=schema_config_snapshot,
|
||||
)
|
||||
billing = await charge_module_prompt_usage(
|
||||
db,
|
||||
@@ -1106,6 +1113,9 @@ async def run_video_prompt_optimize(db: AsyncSession, *, project_id: str, step_i
|
||||
"final_prompt": final_prompt,
|
||||
"params_used_for_prompt": video_config,
|
||||
"target_platform": target_platform,
|
||||
"schema_config_snapshot": schema_config_snapshot,
|
||||
"schema_config_source": schema_config_snapshot.get("source"),
|
||||
"schema_config_version": schema_config_snapshot.get("version"),
|
||||
},
|
||||
usage=usage,
|
||||
),
|
||||
@@ -1121,7 +1131,7 @@ async def run_video_prompt_optimize(db: AsyncSession, *, project_id: str, step_i
|
||||
module=project.module,
|
||||
prompt_type=ModulePromptTypeEnum.VIDEO_PROMPT.value,
|
||||
request=request_log,
|
||||
response={"prompt_schema": prompt_schema, "final_prompt": final_prompt},
|
||||
response={"prompt_schema": prompt_schema, "final_prompt": final_prompt, "schema_config_source": schema_config_snapshot.get("source")},
|
||||
token_usage=usage,
|
||||
)
|
||||
await log_module_event(db, project=project, step=step, event_type=ModuleEventTypeEnum.VIDEO_PROMPT_SUCCESS.value, message="视频 AI 提词生成成功")
|
||||
|
||||
Reference in New Issue
Block a user