|
|
@@ -141,7 +141,7 @@ async def match_feature_with_persona(
|
|
|
|
|
|
|
|
|
async def match_single_feature(
|
|
|
- feature_name: str,
|
|
|
+ feature_item: Dict,
|
|
|
persona_features: List[Dict],
|
|
|
category_mapping: Dict = None,
|
|
|
model_name: str = None
|
|
|
@@ -150,7 +150,7 @@ async def match_single_feature(
|
|
|
匹配单个特征与所有人设特征
|
|
|
|
|
|
Args:
|
|
|
- feature_name: 特征名称
|
|
|
+ feature_item: 特征信息(包含"特征名称"和"权重")
|
|
|
persona_features: 人设特征列表
|
|
|
category_mapping: 特征分类映射字典
|
|
|
model_name: 使用的模型名称
|
|
|
@@ -158,7 +158,10 @@ async def match_single_feature(
|
|
|
Returns:
|
|
|
特征匹配结果
|
|
|
"""
|
|
|
- print(f" 特征: {feature_name}")
|
|
|
+ feature_name = feature_item.get("特征名称", "")
|
|
|
+ feature_weight = feature_item.get("权重", 1.0)
|
|
|
+
|
|
|
+ print(f" 特征: {feature_name} (权重: {feature_weight})")
|
|
|
match_results = await match_feature_with_persona(
|
|
|
feature_name=feature_name,
|
|
|
persona_features=persona_features,
|
|
|
@@ -168,6 +171,7 @@ async def match_single_feature(
|
|
|
|
|
|
return {
|
|
|
"特征名称": feature_name,
|
|
|
+ "权重": feature_weight,
|
|
|
"匹配结果": match_results
|
|
|
}
|
|
|
|
|
|
@@ -198,8 +202,8 @@ async def process_single_inspiration_point(
|
|
|
|
|
|
# 并发匹配所有特征
|
|
|
tasks = [
|
|
|
- match_single_feature(feature_name, persona_features, category_mapping, model_name)
|
|
|
- for feature_name in feature_list
|
|
|
+ match_single_feature(feature_item, persona_features, category_mapping, model_name)
|
|
|
+ for feature_item in feature_list
|
|
|
]
|
|
|
feature_match_results = await asyncio.gather(*tasks)
|
|
|
|