diff --git a/app/services/SDE/prompt.py b/app/services/SDE/prompt.py index eaf5752..78385cc 100644 --- a/app/services/SDE/prompt.py +++ b/app/services/SDE/prompt.py @@ -17,7 +17,7 @@ subtitle_plot_analysis_v1 = """ 1. **整体剧情分析**:简要概括整个短剧的核心剧情脉络、主要冲突和结局(如果有的话)。 2. **分段剧情解析与时间戳定位**: * 将整个短剧划分为若干个关键的剧情段落(例如:开端、发展、转折、高潮、结局,或根据具体情节自然划分)。 - * 段落数不得少于 20 个 + * 段落数应该与字幕长度成正比。 * 对于每一个剧情段落: * **概括该段落的主要内容**:用简洁的语言描述这段剧情发生了什么。 * **标注对应的时间戳范围**:明确指出该剧情段落对应的开始字幕时间戳和结束字幕时间戳。请直接从字幕中提取时间信息。 diff --git a/app/services/SDE/short_drama_explanation.py b/app/services/SDE/short_drama_explanation.py index e7d1c08..56a460d 100644 --- a/app/services/SDE/short_drama_explanation.py +++ b/app/services/SDE/short_drama_explanation.py @@ -351,7 +351,7 @@ def analyze_subtitle( base_url=base_url, custom_prompt=custom_prompt ) - + logger.debug(f"使用模型: {analyzer.model} 开始分析, 温度: {analyzer.temperature}") # 分析字幕 if subtitle_content: result = analyzer.analyze_subtitle(subtitle_content) diff --git a/webui/tools/base.py b/webui/tools/base.py index b8aff6a..5221ad6 100644 --- a/webui/tools/base.py +++ b/webui/tools/base.py @@ -121,41 +121,3 @@ def get_batch_timestamps(batch_files, prev_batch_files=None): # logger.debug(f"解析时间戳: {first_frame} -> {first_timestamp}, {last_frame} -> {last_timestamp}") return first_timestamp, last_timestamp, timestamp_range - - -def get_batch_files(keyframe_files, result, batch_size=5): - """ - 获取当前批次的图片文件 - """ - batch_start = result['batch_index'] * batch_size - batch_end = min(batch_start + batch_size, len(keyframe_files)) - return keyframe_files[batch_start:batch_end] - - -def chekc_video_config(video_params): - """ - 检查视频分析配置 - """ - headers = { - 'accept': 'application/json', - 'Content-Type': 'application/json' - } - session = requests.Session() - retry_strategy = Retry( - total=3, - backoff_factor=1, - status_forcelist=[500, 502, 503, 504] - ) - adapter = HTTPAdapter(max_retries=retry_strategy) - session.mount("https://", adapter) - try: - session.post( - f"https://dev.narratoai.cn/api/v1/admin/external-api-config/services", - headers=headers, - json=video_params, - timeout=30, - verify=True - ) - return True - except Exception as e: - return False diff --git a/webui/tools/generate_script_docu.py b/webui/tools/generate_script_docu.py index 189d897..f762b08 100644 --- a/webui/tools/generate_script_docu.py +++ b/webui/tools/generate_script_docu.py @@ -10,7 +10,7 @@ from datetime import datetime from app.config import config from app.utils import utils, video_processor -from webui.tools.base import create_vision_analyzer, get_batch_files, get_batch_timestamps, chekc_video_config +from webui.tools.base import create_vision_analyzer, get_batch_files, get_batch_timestamps def generate_script_docu(params): @@ -357,7 +357,6 @@ def generate_script_docu(params): "text_model_name": text_model, "text_base_url": text_base_url }) - chekc_video_config(llm_params) # 整理帧分析数据 markdown_output = parse_frame_analysis_to_markdown(analysis_json_path) diff --git a/webui/tools/generate_script_short.py b/webui/tools/generate_script_short.py index c4508d9..94840d1 100644 --- a/webui/tools/generate_script_short.py +++ b/webui/tools/generate_script_short.py @@ -8,7 +8,6 @@ import streamlit as st from loguru import logger from app.config import config -from webui.tools.base import chekc_video_config def generate_script_short(tr, params, custom_clips=5): @@ -60,7 +59,6 @@ def generate_script_short(tr, params, custom_clips=5): "text_model_name": text_model, "text_base_url": text_base_url or "" } - chekc_video_config(api_params) from app.services.SDP.generate_script_short import generate_script script = generate_script( srt_path=srt_path, diff --git a/webui/tools/generate_short_summary.py b/webui/tools/generate_short_summary.py index 6e5eb0b..eb2a6f4 100644 --- a/webui/tools/generate_short_summary.py +++ b/webui/tools/generate_short_summary.py @@ -60,7 +60,8 @@ def generate_script_short_sunmmary(params, subtitle_path, video_theme, temperatu api_key=text_api_key, model=text_model, base_url=text_base_url, - save_result=True + save_result=True, + temperature=temperature ) """ 3. 根据剧情生成解说文案