better:优化心流能力
This commit is contained in:
@@ -32,9 +32,9 @@ HISTORY_LOG_FILENAME = "interest_history.log" # 新的历史日志文件名
|
||||
|
||||
# --- 新增:概率回复相关常量 ---
|
||||
REPLY_TRIGGER_THRESHOLD = 3.0 # 触发概率回复的兴趣阈值 (示例值)
|
||||
BASE_REPLY_PROBABILITY = 0.05 # 首次超过阈值时的基础回复概率 (示例值)
|
||||
BASE_REPLY_PROBABILITY = 0.1 # 首次超过阈值时的基础回复概率 (示例值)
|
||||
PROBABILITY_INCREASE_RATE_PER_SECOND = 0.02 # 高于阈值时,每秒概率增加量 (线性增长, 示例值)
|
||||
PROBABILITY_DECAY_FACTOR_PER_SECOND = 0.3 # 低于阈值时,每秒概率衰减因子 (指数衰减, 示例值)
|
||||
PROBABILITY_DECAY_FACTOR_PER_SECOND = 0.2 # 低于阈值时,每秒概率衰减因子 (指数衰减, 示例值)
|
||||
MAX_REPLY_PROBABILITY = 1 # 回复概率上限 (示例值)
|
||||
# --- 结束:概率回复相关常量 ---
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ class PFChatting:
|
||||
max_tokens=1000,
|
||||
request_type="action_planning",
|
||||
)
|
||||
|
||||
|
||||
# Internal state for loop control
|
||||
self._loop_timer: float = 0.0 # Remaining time for the loop in seconds
|
||||
@@ -711,7 +712,7 @@ class PFChatting:
|
||||
else:
|
||||
prompt += "当前没有观察到新的聊天内容。\n"
|
||||
|
||||
prompt += "\n你的内心想法是:"
|
||||
prompt += "\n看了以上内容,你产生的内心想法是:"
|
||||
if current_mind:
|
||||
prompt += f"\n---\n{current_mind}\n---\n\n"
|
||||
else:
|
||||
|
||||
@@ -109,7 +109,7 @@ def num_new_messages_since_with_users(chat_id: str, timestamp_start: float, time
|
||||
async def _build_readable_messages_internal(
|
||||
messages: List[Dict[str, Any]],
|
||||
replace_bot_name: bool = True,
|
||||
merge_messages: bool = True,
|
||||
merge_messages: bool = False,
|
||||
timestamp_mode: str = "relative" # 新增参数控制时间戳格式
|
||||
) -> Tuple[str, List[Tuple[float, str, str]]]:
|
||||
"""
|
||||
@@ -223,7 +223,7 @@ async def _build_readable_messages_internal(
|
||||
async def build_readable_messages_with_list(
|
||||
messages: List[Dict[str, Any]],
|
||||
replace_bot_name: bool = True,
|
||||
merge_messages: bool = True,
|
||||
merge_messages: bool = False,
|
||||
timestamp_mode: str = "relative"
|
||||
) -> Tuple[str, List[Tuple[float, str, str]]]:
|
||||
"""
|
||||
@@ -238,7 +238,7 @@ async def build_readable_messages_with_list(
|
||||
async def build_readable_messages(
|
||||
messages: List[Dict[str, Any]],
|
||||
replace_bot_name: bool = True,
|
||||
merge_messages: bool = True,
|
||||
merge_messages: bool = False,
|
||||
timestamp_mode: str = "relative"
|
||||
) -> str:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user