fix: correct Zhipu API thinking parameter and add non-interactive archive mode
PR Test / lint (pull_request) Successful in 2s

This commit is contained in:
2026-03-20 00:44:41 +08:00
parent 7903690882
commit 1f599f0c60
4 changed files with 34 additions and 7 deletions
+17 -2
View File
@@ -46,6 +46,8 @@ class ArchiveProcessor(BaseProcessor):
Archive 处理结果
"""
try:
import sys
# Step 1: 检查是否已完成(幂等执行)
if self.state_manager:
state = self.state_manager.load()
@@ -73,7 +75,9 @@ class ArchiveProcessor(BaseProcessor):
platform_dir, input_data.content_id
)
if existing_file:
should_overwrite = self._ask_overwrite(existing_file)
# 检测是否为非交互式环境
is_non_interactive = not sys.stdin.isatty()
should_overwrite = self._ask_overwrite(existing_file, is_non_interactive)
if not should_overwrite:
logger.info(f"User chose not to overwrite, skipping archive")
return ArchiveOutput(
@@ -143,17 +147,28 @@ class ArchiveProcessor(BaseProcessor):
matches = list(platform_dir.glob(pattern))
return matches[0] if matches else None
def _ask_overwrite(self, existing_file: Path) -> bool:
def _ask_overwrite(self, existing_file: Path, is_non_interactive: bool = False) -> bool:
"""询问用户是否覆盖已存在的文件
使用 rich.prompt.Confirm 模式(与 Pipeline._ask_rerun_step 相同)
Args:
existing_file: 已存在的文件路径
is_non_interactive: 是否为非交互式环境(stdin不是tty)
Returns:
True 如果用户选择覆盖
"""
# 非交互式模式:使用配置决定
if is_non_interactive:
if self.settings.overwrite_archives:
logger.info(f"Non-interactive mode: Overwriting existing archive (KB_OVERWRITE_ARCHIVES=true): {existing_file.name}")
return True
else:
logger.info(f"Non-interactive mode: Skipping existing archive (KB_OVERWRITE_ARCHIVES=false): {existing_file.name}")
return False
# 交互式模式:询问用户
try:
from rich.console import Console
from rich.prompt import Confirm