创建新分支feature

This commit is contained in:
tcmofashi
2025-03-03 10:15:21 +08:00
parent b8bd45d429
commit 2e9030b65f
6 changed files with 18 additions and 23 deletions

2
.env
View File

@@ -1,5 +1,5 @@
# 您不应该修改默认值,这个文件被仓库索引,请修改.env.prod
ENVIRONMENT=dev
ENVIRONMENT=prod
# HOST=127.0.0.1
# PORT=8080

View File

@@ -1,11 +1,11 @@
[bot]
qq = 3488737411
nickname = "小千"
qq = 123
nickname = "麦麦"
[message]
min_text_length = 2
max_context_size = 15
emoji_chance = 0.0
emoji_chance = 0.2
[emoji]
check_interval = 120
@@ -29,7 +29,8 @@ enable_advance_output = true
[groups]
talk_allowed = [
583449463
123,
123,
]
talk_frequency_down = []
ban_user_id = []

View File

@@ -28,7 +28,7 @@ class BotConfig:
talk_frequency_down_groups = set()
ban_user_id = set()
build_memory_interval: int = 600 # 记忆构建间隔(秒)
build_memory_interval: int = 60 # 记忆构建间隔(秒)
EMOJI_CHECK_INTERVAL: int = 120 # 表情包检查间隔(分钟)
EMOJI_REGISTER_INTERVAL: int = 10 # 表情包注册间隔(分钟)
@@ -139,13 +139,6 @@ class BotConfig:
others_config = toml_dict["others"]
config.enable_advance_output = others_config.get("enable_advance_output", config.enable_advance_output)
# 自定义人设覆盖
config.PROMPT_PERSONALITY=[
"是一个计算机系大三女大学生平时比较文静喜欢打舞萌dx你会刷贴吧偶尔也会像贴吧老哥一样阴阳怪气你正在浏览qq群",
"是一个计算机系大三女大学生平时比较文静喜欢打舞萌dx你有黑色头发你会刷小红书, 你正在浏览qq群"
]
config.PROMPT_SCHEDULE_GEN="一个计算机系大三女大学生喜欢刷qq贴吧知乎和小红书还喜欢打舞萌dx经常下午或者晚上去江二打舞萌睡得比较晚有时会熬夜"
logger.success(f"成功加载配置文件: {config_path}")

View File

@@ -73,7 +73,7 @@ class TopicIdentifier:
'', '按照', '', '', '', '比如', '', '除了', '', '', '对于',
'根据', '关于', '', '', '', '', '经过', '', '', '', '通过',
'', '', '', '为了', '围绕', '', '', '由于', '', '', '沿', '沿着',
'', '依照', '', '', '因为', '', '', '', '', '自从','[]'
'', '依照', '', '', '因为', '', '', '', '', '自从'
}
# 过滤掉停用词和标点符号,只保留名词和动词

View File

@@ -58,8 +58,8 @@ class WillingManager:
if group_id in config.talk_frequency_down_groups:
reply_probability = reply_probability / 3.5
if is_mentioned_bot and user_id == int(964959351):
reply_probability = 1
# if is_mentioned_bot and user_id == int(1026294844):
# reply_probability = 1
return reply_probability
@@ -72,7 +72,7 @@ class WillingManager:
"""发送消息后提高群组的回复意愿"""
current_willing = self.group_reply_willing.get(group_id, 0)
if current_willing < 1:
self.group_reply_willing[group_id] = min(2, current_willing + 0.8)
self.group_reply_willing[group_id] = min(1, current_willing + 0.3)
async def ensure_started(self):
"""确保衰减任务已启动"""

View File

@@ -142,12 +142,13 @@ class Memory_graph:
# 获取该时间戳之后的length条消息且groupid相同
chat_record = list(self.db.db.messages.find({"time": {"$gt": closest_time}, "group_id": group_id}).sort('time', 1).limit(length))
for record in chat_record:
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
try:
displayname="[(%s)%s]%s" % (record["user_id"],record["user_nickname"],record["user_cardname"])
except:
displayname=record["user_nickname"] or "用户" + str(record["user_id"])
chat_text += f'[{time_str}] {displayname}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
if record:
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
try:
displayname="[(%s)%s]%s" % (record["user_id"],record["user_nickname"],record["user_cardname"])
except:
displayname=record["user_nickname"] or "用户" + str(record["user_id"])
chat_text += f'[{time_str}] {displayname}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
return chat_text
return [] # 如果没有找到记录,返回空列表