|
@@ -314,6 +314,12 @@ async def run_full_analysis(
|
|
|
print(f"Step4: 搜索结果与灵感匹配")
|
|
print(f"Step4: 搜索结果与灵感匹配")
|
|
|
print(f"{'─' * 80}\n")
|
|
print(f"{'─' * 80}\n")
|
|
|
|
|
|
|
|
|
|
+ # 如果 force=True,删除已有的 step4 文件
|
|
|
|
|
+ if force and step4_exists:
|
|
|
|
|
+ for f in step4_files:
|
|
|
|
|
+ os.remove(f)
|
|
|
|
|
+ print(f"✓ 已删除旧文件: {f}")
|
|
|
|
|
+
|
|
|
# 临时修改 sys.argv 来传递参数给 step4
|
|
# 临时修改 sys.argv 来传递参数给 step4
|
|
|
sys.argv = [
|
|
sys.argv = [
|
|
|
"step4_search_result_match.py",
|
|
"step4_search_result_match.py",
|
|
@@ -493,6 +499,9 @@ async def main():
|
|
|
# 搜索并匹配模式:基于已有 Step1 结果,执行搜索和 Step4 匹配
|
|
# 搜索并匹配模式:基于已有 Step1 结果,执行搜索和 Step4 匹配
|
|
|
python run_inspiration_analysis.py --search-and-match --count 10
|
|
python run_inspiration_analysis.py --search-and-match --count 10
|
|
|
|
|
|
|
|
|
|
+ # 从第11个开始,处理10个灵感
|
|
|
|
|
+ python run_inspiration_analysis.py --search-and-match --start 11 --count 10
|
|
|
|
|
+
|
|
|
# 处理所有灵感,强制重新执行
|
|
# 处理所有灵感,强制重新执行
|
|
|
python run_inspiration_analysis.py --count all --force
|
|
python run_inspiration_analysis.py --count all --force
|
|
|
|
|
|
|
@@ -520,6 +529,13 @@ async def main():
|
|
|
help="处理的灵感数量,可以是数字或 'all' (默认: 1, 当指定 --inspiration 时忽略)"
|
|
help="处理的灵感数量,可以是数字或 'all' (默认: 1, 当指定 --inspiration 时忽略)"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ parser.add_argument(
|
|
|
|
|
+ "--start",
|
|
|
|
|
+ type=int,
|
|
|
|
|
+ default=1,
|
|
|
|
|
+ help="起始位置(从1开始),与 --count 配合使用 (默认: 1)"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
parser.add_argument(
|
|
parser.add_argument(
|
|
|
"--max-tasks",
|
|
"--max-tasks",
|
|
|
type=str,
|
|
type=str,
|
|
@@ -572,6 +588,7 @@ async def main():
|
|
|
enable_step2 = args.enable_step2
|
|
enable_step2 = args.enable_step2
|
|
|
search_only = args.search_only
|
|
search_only = args.search_only
|
|
|
search_and_match = args.search_and_match
|
|
search_and_match = args.search_and_match
|
|
|
|
|
+ start_index = args.start
|
|
|
|
|
|
|
|
# 互斥检查
|
|
# 互斥检查
|
|
|
if search_only and search_and_match:
|
|
if search_only and search_and_match:
|
|
@@ -619,11 +636,14 @@ async def main():
|
|
|
skip_selection = False
|
|
skip_selection = False
|
|
|
# 确定要处理的灵感数量
|
|
# 确定要处理的灵感数量
|
|
|
if args.count == "all":
|
|
if args.count == "all":
|
|
|
- inspiration_count = len(inspiration_list)
|
|
|
|
|
- print(f"处理灵感: 全部 ({inspiration_count} 个)")
|
|
|
|
|
|
|
+ inspiration_count = len(inspiration_list) - (start_index - 1)
|
|
|
|
|
+ print(f"处理灵感: 从第 {start_index} 个到最后 (共 {inspiration_count} 个)")
|
|
|
else:
|
|
else:
|
|
|
inspiration_count = int(args.count)
|
|
inspiration_count = int(args.count)
|
|
|
- print(f"处理灵感: 前 {inspiration_count} 个")
|
|
|
|
|
|
|
+ if start_index > 1:
|
|
|
|
|
+ print(f"处理灵感: 从第 {start_index} 个开始,共 {inspiration_count} 个")
|
|
|
|
|
+ else:
|
|
|
|
|
+ print(f"处理灵感: 前 {inspiration_count} 个")
|
|
|
|
|
|
|
|
if max_tasks:
|
|
if max_tasks:
|
|
|
print(f"Step1 任务数限制: {max_tasks}")
|
|
print(f"Step1 任务数限制: {max_tasks}")
|
|
@@ -648,18 +668,31 @@ async def main():
|
|
|
|
|
|
|
|
# 选择要处理的灵感列表(如果没有指定 --inspiration)
|
|
# 选择要处理的灵感列表(如果没有指定 --inspiration)
|
|
|
if not skip_selection:
|
|
if not skip_selection:
|
|
|
|
|
+ # 验证 start_index
|
|
|
|
|
+ if start_index < 1:
|
|
|
|
|
+ print(f"❌ 错误: --start 必须 >= 1")
|
|
|
|
|
+ sys.exit(1)
|
|
|
|
|
+
|
|
|
if sort_by_score:
|
|
if sort_by_score:
|
|
|
# 根据 Step1 结果分数排序
|
|
# 根据 Step1 结果分数排序
|
|
|
sorted_list = sort_inspirations_by_score(persona_dir, inspiration_list, max_tasks)
|
|
sorted_list = sort_inspirations_by_score(persona_dir, inspiration_list, max_tasks)
|
|
|
- inspirations_to_process = sorted_list[:inspiration_count]
|
|
|
|
|
|
|
+ # 应用 start 和 count(start 从 1 开始,转换为 0 索引)
|
|
|
|
|
+ start_idx = start_index - 1
|
|
|
|
|
+ end_idx = start_idx + inspiration_count
|
|
|
|
|
+ inspirations_to_process = sorted_list[start_idx:end_idx]
|
|
|
elif shuffle:
|
|
elif shuffle:
|
|
|
# 随机打乱灵感列表后选择
|
|
# 随机打乱灵感列表后选择
|
|
|
shuffled_list = inspiration_list.copy()
|
|
shuffled_list = inspiration_list.copy()
|
|
|
random.shuffle(shuffled_list)
|
|
random.shuffle(shuffled_list)
|
|
|
- inspirations_to_process = shuffled_list[:inspiration_count]
|
|
|
|
|
|
|
+ # 应用 start 和 count
|
|
|
|
|
+ start_idx = start_index - 1
|
|
|
|
|
+ end_idx = start_idx + inspiration_count
|
|
|
|
|
+ inspirations_to_process = shuffled_list[start_idx:end_idx]
|
|
|
else:
|
|
else:
|
|
|
- # 按顺序选择前 N 个
|
|
|
|
|
- inspirations_to_process = inspiration_list[:inspiration_count]
|
|
|
|
|
|
|
+ # 按顺序选择,应用 start 和 count
|
|
|
|
|
+ start_idx = start_index - 1
|
|
|
|
|
+ end_idx = start_idx + inspiration_count
|
|
|
|
|
+ inspirations_to_process = inspiration_list[start_idx:end_idx]
|
|
|
|
|
|
|
|
print(f"\n将处理以下灵感:")
|
|
print(f"\n将处理以下灵感:")
|
|
|
for i, insp in enumerate(inspirations_to_process, 1):
|
|
for i, insp in enumerate(inspirations_to_process, 1):
|