|
@@ -469,6 +469,12 @@ async def main():
|
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
|
epilog="""
|
|
epilog="""
|
|
|
使用示例:
|
|
使用示例:
|
|
|
|
|
+ # 处理指定的灵感(通过名称)
|
|
|
|
|
+ python run_inspiration_analysis.py --inspiration "内容植入品牌推广"
|
|
|
|
|
+
|
|
|
|
|
+ # 处理指定的灵感(通过索引,0表示第1个)
|
|
|
|
|
+ python run_inspiration_analysis.py --inspiration 0
|
|
|
|
|
+
|
|
|
# 处理第1个灵感(Step1 + 搜索,默认不执行 Step2)
|
|
# 处理第1个灵感(Step1 + 搜索,默认不执行 Step2)
|
|
|
python run_inspiration_analysis.py --dir data/阿里多多酱/out/人设_1110 --count 1
|
|
python run_inspiration_analysis.py --dir data/阿里多多酱/out/人设_1110 --count 1
|
|
|
|
|
|
|
@@ -501,10 +507,17 @@ async def main():
|
|
|
help="人设目录路径 (默认: data/阿里多多酱/out/人设_1110)"
|
|
help="人设目录路径 (默认: data/阿里多多酱/out/人设_1110)"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ parser.add_argument(
|
|
|
|
|
+ "--inspiration",
|
|
|
|
|
+ type=str,
|
|
|
|
|
+ default=None,
|
|
|
|
|
+ help="指定要处理的灵感(可以是灵感名称或索引,如 '内容植入品牌推广' 或 '0')"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
parser.add_argument(
|
|
parser.add_argument(
|
|
|
"--count",
|
|
"--count",
|
|
|
default="1",
|
|
default="1",
|
|
|
- help="处理的灵感数量,可以是数字或 'all' (默认: 1)"
|
|
|
|
|
|
|
+ help="处理的灵感数量,可以是数字或 'all' (默认: 1, 当指定 --inspiration 时忽略)"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
parser.add_argument(
|
|
@@ -592,13 +605,25 @@ async def main():
|
|
|
# 加载灵感列表
|
|
# 加载灵感列表
|
|
|
inspiration_list = load_inspiration_list(persona_dir)
|
|
inspiration_list = load_inspiration_list(persona_dir)
|
|
|
|
|
|
|
|
- # 确定要处理的灵感数量
|
|
|
|
|
- if args.count == "all":
|
|
|
|
|
- inspiration_count = len(inspiration_list)
|
|
|
|
|
- print(f"处理灵感: 全部 ({inspiration_count} 个)")
|
|
|
|
|
|
|
+ # 处理 --inspiration 参数(优先级最高)
|
|
|
|
|
+ if args.inspiration is not None:
|
|
|
|
|
+ from lib.data_loader import select_inspiration
|
|
|
|
|
+ selected_inspiration = select_inspiration(args.inspiration, inspiration_list)
|
|
|
|
|
+ inspirations_to_process = [selected_inspiration]
|
|
|
|
|
+ print(f"处理灵感: {selected_inspiration}")
|
|
|
|
|
+
|
|
|
|
|
+ # 跳过后续的选择逻辑
|
|
|
|
|
+ inspiration_count = 1
|
|
|
|
|
+ skip_selection = True
|
|
|
else:
|
|
else:
|
|
|
- inspiration_count = int(args.count)
|
|
|
|
|
- print(f"处理灵感: 前 {inspiration_count} 个")
|
|
|
|
|
|
|
+ skip_selection = False
|
|
|
|
|
+ # 确定要处理的灵感数量
|
|
|
|
|
+ if args.count == "all":
|
|
|
|
|
+ inspiration_count = len(inspiration_list)
|
|
|
|
|
+ print(f"处理灵感: 全部 ({inspiration_count} 个)")
|
|
|
|
|
+ else:
|
|
|
|
|
+ inspiration_count = int(args.count)
|
|
|
|
|
+ print(f"处理灵感: 前 {inspiration_count} 个")
|
|
|
|
|
|
|
|
if max_tasks:
|
|
if max_tasks:
|
|
|
print(f"Step1 任务数限制: {max_tasks}")
|
|
print(f"Step1 任务数限制: {max_tasks}")
|
|
@@ -621,19 +646,20 @@ async def main():
|
|
|
else:
|
|
else:
|
|
|
print(f"Step2: 已关闭(使用 --enable-step2 启用)")
|
|
print(f"Step2: 已关闭(使用 --enable-step2 启用)")
|
|
|
|
|
|
|
|
- # 选择要处理的灵感列表
|
|
|
|
|
- if sort_by_score:
|
|
|
|
|
- # 根据 Step1 结果分数排序
|
|
|
|
|
- sorted_list = sort_inspirations_by_score(persona_dir, inspiration_list, max_tasks)
|
|
|
|
|
- inspirations_to_process = sorted_list[:inspiration_count]
|
|
|
|
|
- elif shuffle:
|
|
|
|
|
- # 随机打乱灵感列表后选择
|
|
|
|
|
- shuffled_list = inspiration_list.copy()
|
|
|
|
|
- random.shuffle(shuffled_list)
|
|
|
|
|
- inspirations_to_process = shuffled_list[:inspiration_count]
|
|
|
|
|
- else:
|
|
|
|
|
- # 按顺序选择前 N 个
|
|
|
|
|
- inspirations_to_process = inspiration_list[:inspiration_count]
|
|
|
|
|
|
|
+ # 选择要处理的灵感列表(如果没有指定 --inspiration)
|
|
|
|
|
+ if not skip_selection:
|
|
|
|
|
+ if sort_by_score:
|
|
|
|
|
+ # 根据 Step1 结果分数排序
|
|
|
|
|
+ sorted_list = sort_inspirations_by_score(persona_dir, inspiration_list, max_tasks)
|
|
|
|
|
+ inspirations_to_process = sorted_list[:inspiration_count]
|
|
|
|
|
+ elif shuffle:
|
|
|
|
|
+ # 随机打乱灵感列表后选择
|
|
|
|
|
+ shuffled_list = inspiration_list.copy()
|
|
|
|
|
+ random.shuffle(shuffled_list)
|
|
|
|
|
+ inspirations_to_process = shuffled_list[:inspiration_count]
|
|
|
|
|
+ else:
|
|
|
|
|
+ # 按顺序选择前 N 个
|
|
|
|
|
+ inspirations_to_process = inspiration_list[:inspiration_count]
|
|
|
|
|
|
|
|
print(f"\n将处理以下灵感:")
|
|
print(f"\n将处理以下灵感:")
|
|
|
for i, insp in enumerate(inspirations_to_process, 1):
|
|
for i, insp in enumerate(inspirations_to_process, 1):
|