优化全能创作
Deploy dev / deploy (push) Successful in 39s

This commit is contained in:
Azmat@qq.com
2026-09-29 15:15:54 +08:00
parent 1130ecd4ba
commit c687ec4bbd
16 changed files with 632 additions and 258 deletions
+11
View File
@@ -1,5 +1,6 @@
from rest_framework import serializers
from .creation_presets import PLOT_TWIST_PRESET
from .models import (
AITask,
CreationConversation,
@@ -246,6 +247,16 @@ class CreationConversationSerializer(serializers.ModelSerializer):
progress["history"] = list(reversed(unique_reversed))[-12:]
return progress
def create(self, validated_data):
# 剧情反转带货的新会话直接以完整短剧的 60 秒开场,不再弹故事深度选择。
# 旧客户端仍传「智能时长」时也要在服务端落成确定参数。
if validated_data.get("mode") == CreationConversation.Mode.VIDEO and validated_data.get("preset") == PLOT_TWIST_PRESET:
params = dict(validated_data.get("params") or {})
if not str(params.get("duration") or "").strip() or str(params.get("duration")).strip() == "智能时长":
params["duration"] = "60 秒"
validated_data["params"] = params
return super().create(validated_data)
def update(self, instance, validated_data):
# mode 定死:允许传但忽略,避免前端误改后顶栏参数与已生成内容对不上
validated_data.pop("mode", None)