From 187a97d2191f0879bbfec01e1e955bd5f5250392 Mon Sep 17 00:00:00 2001
From: hit-cxf <2024111082@stu.hit.edu.cn>
Date: Fri, 08 May 2026 23:47:11 +0800
Subject: [PATCH] 优化了项目配置管理,使用config.yaml文件存储密钥、默认模型、代理配置,并支持WebUI配置api
---
aigc-director/aigc-claw/backend/pipelines/standard.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/aigc-director/aigc-claw/backend/pipelines/standard.py b/aigc-director/aigc-claw/backend/pipelines/standard.py
index e9a38ed..f43699c 100644
--- a/aigc-director/aigc-claw/backend/pipelines/standard.py
+++ b/aigc-director/aigc-claw/backend/pipelines/standard.py
@@ -3,7 +3,6 @@
import os
import re
-from config import settings
from models.llm_client import LLM
from prompts.loader import format_prompt, load_prompt
@@ -27,6 +26,13 @@
)
logger = logging.getLogger(__name__)
+
+
+def required_param(params: dict, key: str) -> str:
+ value = params.get(key)
+ if not value:
+ raise ValueError(f"standard pipeline requires {key}")
+ return str(value)
def split_by_periods(text: str) -> list[str]:
@@ -137,7 +143,7 @@
mode = params.get("mode") or "copy"
source_text = text.strip()
llm = None
- llm_model = params.get("llm_model") or settings.LLM_MODEL
+ llm_model = required_param(params, "llm_model")
if mode == "inspiration":
segment_count = clamp_segment_count(params.get("segment_count"))
update_task(task_id, progress=6, message="Writing narration from inspiration")
@@ -169,12 +175,16 @@
style_control = (params.get("style_control") or params.get("negative_prompt") or DEFAULT_STYLE_CONTROL).strip()
video_ratio = params.get("video_ratio") or "9:16"
- image_model = params.get("image_model") or params.get("image_workflow") or settings.IMAGE_T2I_MODEL
+ image_model = params.get("image_model") or params.get("image_workflow")
+ if not image_model:
+ raise ValueError("standard pipeline requires image_model")
image_resolution = params.get("image_resolution") or "1080P"
enable_subtitles = bool(params.get("enable_subtitles", False))
video_mode = params.get("video_mode") or "image_concat"
dynamic_video = video_mode == "dynamic_video" or bool(params.get("generate_videos", False))
- video_model = params.get("video_model") or settings.VIDEO_MODEL
+ video_model = params.get("video_model")
+ if dynamic_video and not video_model:
+ raise ValueError("standard pipeline dynamic_video mode requires video_model")
video_duration = clamp_segment_count(params.get("video_duration") or params.get("duration") or 5, default=5)
update_task(task_id, progress=9, message="Generating image prompts")
--
Gitblit v1.8.0