fuk:fucc
This commit is contained in:
@@ -9,8 +9,8 @@ def 计算字符串长度(输入字符串: str) -> int:
|
|||||||
"""
|
"""
|
||||||
return len(输入字符串)
|
return len(输入字符串)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# 测试代码
|
# 测试代码
|
||||||
测试字符串 = '''你。'''
|
测试字符串 = """你。"""
|
||||||
print(f"字符串 '{测试字符串}' 的长度是: {计算字符串长度(测试字符串)}")
|
print(f"字符串 '{测试字符串}' 的长度是: {计算字符串长度(测试字符串)}")
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ def init_prompt():
|
|||||||
"reasoning_prompt_main",
|
"reasoning_prompt_main",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
Prompt(
|
Prompt(
|
||||||
"你回忆起:{related_memory_info}。\n以上是你的回忆,不一定是目前聊天里的人说的,也不一定是现在发生的事情,请记住。\n",
|
"你回忆起:{related_memory_info}。\n以上是你的回忆,不一定是目前聊天里的人说的,也不一定是现在发生的事情,请记住。\n",
|
||||||
"memory_prompt",
|
"memory_prompt",
|
||||||
@@ -197,24 +196,20 @@ class PromptBuilder:
|
|||||||
("给出日常且口语化的回复,平淡一些", 0.4), # 40%概率
|
("给出日常且口语化的回复,平淡一些", 0.4), # 40%概率
|
||||||
("给出非常简短的回复", 0.4), # 40%概率
|
("给出非常简短的回复", 0.4), # 40%概率
|
||||||
("给出缺失主语的回复,简短", 0.15), # 15%概率
|
("给出缺失主语的回复,简短", 0.15), # 15%概率
|
||||||
("给出带有语病的回复,朴实平淡", 0.05) # 5%概率
|
("给出带有语病的回复,朴实平淡", 0.05), # 5%概率
|
||||||
]
|
]
|
||||||
reply_style1_chosen = random.choices(
|
reply_style1_chosen = random.choices(
|
||||||
[style[0] for style in reply_styles1],
|
[style[0] for style in reply_styles1], weights=[style[1] for style in reply_styles1], k=1
|
||||||
weights=[style[1] for style in reply_styles1],
|
|
||||||
k=1
|
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
reply_styles2 = [
|
reply_styles2 = [
|
||||||
("不要回复的太有条理,可以有个性", 0.6), # 60%概率
|
("不要回复的太有条理,可以有个性", 0.6), # 60%概率
|
||||||
("不要回复的太有条理,可以复读", 0.15), # 15%概率
|
("不要回复的太有条理,可以复读", 0.15), # 15%概率
|
||||||
("回复的认真一些", 0.2), # 20%概率
|
("回复的认真一些", 0.2), # 20%概率
|
||||||
("可以回复单个表情符号", 0.05) # 5%概率
|
("可以回复单个表情符号", 0.05), # 5%概率
|
||||||
]
|
]
|
||||||
reply_style2_chosen = random.choices(
|
reply_style2_chosen = random.choices(
|
||||||
[style[0] for style in reply_styles2],
|
[style[0] for style in reply_styles2], weights=[style[1] for style in reply_styles2], k=1
|
||||||
weights=[style[1] for style in reply_styles2],
|
|
||||||
k=1
|
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
if structured_info:
|
if structured_info:
|
||||||
@@ -276,24 +271,20 @@ class PromptBuilder:
|
|||||||
("然后给出日常且口语化的回复,平淡一些", 0.4), # 40%概率
|
("然后给出日常且口语化的回复,平淡一些", 0.4), # 40%概率
|
||||||
("给出非常简短的回复", 0.4), # 40%概率
|
("给出非常简短的回复", 0.4), # 40%概率
|
||||||
("给出缺失主语的回复", 0.15), # 15%概率
|
("给出缺失主语的回复", 0.15), # 15%概率
|
||||||
("给出带有语病的回复", 0.05) # 5%概率
|
("给出带有语病的回复", 0.05), # 5%概率
|
||||||
]
|
]
|
||||||
reply_style1_chosen = random.choices(
|
reply_style1_chosen = random.choices(
|
||||||
[style[0] for style in reply_styles1],
|
[style[0] for style in reply_styles1], weights=[style[1] for style in reply_styles1], k=1
|
||||||
weights=[style[1] for style in reply_styles1],
|
|
||||||
k=1
|
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
reply_styles2 = [
|
reply_styles2 = [
|
||||||
("不要回复的太有条理,可以有个性", 0.6), # 60%概率
|
("不要回复的太有条理,可以有个性", 0.6), # 60%概率
|
||||||
("不要回复的太有条理,可以复读", 0.15), # 15%概率
|
("不要回复的太有条理,可以复读", 0.15), # 15%概率
|
||||||
("回复的认真一些", 0.2), # 20%概率
|
("回复的认真一些", 0.2), # 20%概率
|
||||||
("可以回复单个表情符号", 0.05) # 5%概率
|
("可以回复单个表情符号", 0.05), # 5%概率
|
||||||
]
|
]
|
||||||
reply_style2_chosen = random.choices(
|
reply_style2_chosen = random.choices(
|
||||||
[style[0] for style in reply_styles2],
|
[style[0] for style in reply_styles2], weights=[style[1] for style in reply_styles2], k=1
|
||||||
weights=[style[1] for style in reply_styles2],
|
|
||||||
k=1
|
|
||||||
)[0]
|
)[0]
|
||||||
|
|
||||||
# 调取记忆
|
# 调取记忆
|
||||||
|
|||||||
@@ -292,10 +292,7 @@ class RelationshipManager:
|
|||||||
"友善和包容的回复",
|
"友善和包容的回复",
|
||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return f"你{relationship_level[level_num]}{person_name},打算{relation_prompt2_list[level_num]}。\n"
|
||||||
f"你{relationship_level[level_num]}{person_name},"
|
|
||||||
f"打算{relation_prompt2_list[level_num]}。\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def calculate_level_num(relationship_value) -> int:
|
def calculate_level_num(relationship_value) -> int:
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ async def _build_readable_messages_internal(
|
|||||||
if not stripped_line.endswith("(内容太长)"):
|
if not stripped_line.endswith("(内容太长)"):
|
||||||
output_lines.append(f"{stripped_line};")
|
output_lines.append(f"{stripped_line};")
|
||||||
else:
|
else:
|
||||||
output_lines.append(stripped_line) # 直接添加截断后的内容
|
output_lines.append(stripped_line) # 直接添加截断后的内容
|
||||||
output_lines.append("\n") # 在每个消息块后添加换行,保持可读性
|
output_lines.append("\n") # 在每个消息块后添加换行,保持可读性
|
||||||
|
|
||||||
# 移除可能的多余换行,然后合并
|
# 移除可能的多余换行,然后合并
|
||||||
|
|||||||
Reference in New Issue
Block a user