FIX:类型问题

This commit is contained in:
SengokuCola
2025-08-12 01:45:17 +08:00
parent 0f6ed0fe02
commit 996ac18680
2 changed files with 20 additions and 12 deletions

View File

@@ -138,28 +138,36 @@ class RelationshipFetcher:
relation_info = ""
attitude_info = ""
attitude_parts = attitude_to_me.split(',')
current_attitude_score = float(attitude_parts[0]) if len(attitude_parts) > 0 else 0.0
total_confidence = float(attitude_parts[1]) if len(attitude_parts) > 1 else 1.0
if attitude_to_me:
if attitude_to_me > 8:
if current_attitude_score > 8:
attitude_info = f"{person_name}对你的态度十分好,"
elif attitude_to_me > 5:
elif current_attitude_score > 5:
attitude_info = f"{person_name}对你的态度较好,"
if attitude_to_me < -8:
if current_attitude_score < -8:
attitude_info = f"{person_name}对你的态度十分恶劣,"
elif attitude_to_me < -4:
elif current_attitude_score < -4:
attitude_info = f"{person_name}对你的态度不好,"
elif attitude_to_me < 0:
elif current_attitude_score < 0:
attitude_info = f"{person_name}对你的态度一般,"
if neuroticism:
if neuroticism > 8:
neuroticism_info = f"{person_name}的情绪十分活跃,容易情绪化,"
elif neuroticism > 6:
neuroticism_info = f"{person_name}的情绪比较活跃,"
elif neuroticism > 4:
neuroticism_info = ""
elif neuroticism > 2:
neuroticism_parts = neuroticism.split(',')
current_neuroticism_score = float(neuroticism_parts[0]) if len(neuroticism_parts) > 0 else 0.0
total_confidence = float(neuroticism_parts[1]) if len(neuroticism_parts) > 1 else 1.0
if neuroticism:
if current_neuroticism_score > 8:
neuroticism_info = f"{person_name}的情绪十分活跃,容易情绪化,"
elif current_neuroticism_score > 6:
neuroticism_info = f"{person_name}的情绪比较活跃,"
elif current_neuroticism_score > 4:
neuroticism_info = ""
elif current_neuroticism_score > 2:
neuroticism_info = f"{person_name}的情绪比较稳定,"
else:
neuroticism_info = f"{person_name}的情绪非常稳定,毫无波动"

View File

@@ -278,7 +278,7 @@ class RelationshipManager:
current_time = datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
# 解析当前态度值
attitude_parts = current_attitude.split(',')
current_attitude_score = int(attitude_parts[0]) if len(attitude_parts) > 0 else 0
current_attitude_score = float(attitude_parts[0]) if len(attitude_parts) > 0 else 0.0
total_confidence = float(attitude_parts[1]) if len(attitude_parts) > 1 else 1.0
prompt = await global_prompt_manager.format_prompt(
@@ -316,7 +316,7 @@ class RelationshipManager:
current_time = datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
# 解析当前态度值
neuroticism_parts = current_neuroticism.split(',')
current_neuroticism_score = int(neuroticism_parts[0]) if len(neuroticism_parts) > 0 else 0
current_neuroticism_score = float(neuroticism_parts[0]) if len(neuroticism_parts) > 0 else 0.0
total_confidence = float(neuroticism_parts[1]) if len(neuroticism_parts) > 1 else 1.0
prompt = await global_prompt_manager.format_prompt(