feat: 添加回复情绪对好感度的影响,修改用户显示名字为群昵称
This commit is contained in:
@@ -90,6 +90,7 @@ class ChatBot:
|
|||||||
group_id=event.group_id,
|
group_id=event.group_id,
|
||||||
user_id=event.user_id,
|
user_id=event.user_id,
|
||||||
message_id=event.message_id,
|
message_id=event.message_id,
|
||||||
|
user_cardname=sender_info['card'],
|
||||||
raw_message=str(event.original_message),
|
raw_message=str(event.original_message),
|
||||||
plain_text=event.get_plaintext(),
|
plain_text=event.get_plaintext(),
|
||||||
reply_message=event.reply,
|
reply_message=event.reply,
|
||||||
@@ -141,6 +142,9 @@ class ChatBot:
|
|||||||
willing_manager.change_reply_willing_sent(thinking_message.group_id)
|
willing_manager.change_reply_willing_sent(thinking_message.group_id)
|
||||||
|
|
||||||
response, emotion = await self.gpt.generate_response(message)
|
response, emotion = await self.gpt.generate_response(message)
|
||||||
|
|
||||||
|
if response is None:
|
||||||
|
thinking_message.interupt=True
|
||||||
|
|
||||||
# 如果生成了回复,发送并记录
|
# 如果生成了回复,发送并记录
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ class BotConfig:
|
|||||||
|
|
||||||
enable_advance_output: bool = False # 是否启用高级输出
|
enable_advance_output: bool = False # 是否启用高级输出
|
||||||
enable_kuuki_read: bool = True # 是否启用读空气功能
|
enable_kuuki_read: bool = True # 是否启用读空气功能
|
||||||
|
|
||||||
|
# 默认人设
|
||||||
|
PROMPT_PERSONALITY=[
|
||||||
|
"曾经是一个学习地质的女大学生,现在学习心理学和脑科学,你会刷贴吧,你正在浏览qq群",
|
||||||
|
"是一个女大学生,你有黑色头发,你会刷小红书, 你正在浏览qq群"
|
||||||
|
]
|
||||||
|
PROMPT_SCHEDULE_GEN="一个曾经学习地质,现在学习心理学和脑科学的女大学生,喜欢刷qq,贴吧,知乎和小红书"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_default_config_path() -> str:
|
def get_default_config_path() -> str:
|
||||||
@@ -123,6 +130,14 @@ class BotConfig:
|
|||||||
if "others" in toml_dict:
|
if "others" in toml_dict:
|
||||||
others_config = toml_dict["others"]
|
others_config = toml_dict["others"]
|
||||||
config.enable_advance_output = others_config.get("enable_advance_output", config.enable_advance_output)
|
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}")
|
logger.success(f"成功加载配置文件: {config_path}")
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ class LLMResponseGenerator:
|
|||||||
|
|
||||||
if model_response:
|
if model_response:
|
||||||
print(f"为 '{model_response}' 获取到的情感标签为:{emotion}")
|
print(f"为 '{model_response}' 获取到的情感标签为:{emotion}")
|
||||||
|
valuedict={
|
||||||
|
'happy':0.5,'angry':-1,'sad':-0.5,'surprised':0.5,'disgusted':-1.5,'fearful':-0.25,'neutral':0.25
|
||||||
|
}
|
||||||
|
await relationship_manager.update_relationship_value(message.user_id, relationship_value=valuedict[emotion[0]])
|
||||||
|
|
||||||
|
|
||||||
return model_response, emotion
|
return model_response, emotion
|
||||||
|
|
||||||
async def _generate_base_response(
|
async def _generate_base_response(
|
||||||
@@ -82,6 +87,8 @@ class LLMResponseGenerator:
|
|||||||
model_params: Optional[Dict[str, Any]] = None
|
model_params: Optional[Dict[str, Any]] = None
|
||||||
) -> Optional[str]:
|
) -> Optional[str]:
|
||||||
sender_name = message.user_nickname or f"用户{message.user_id}"
|
sender_name = message.user_nickname or f"用户{message.user_id}"
|
||||||
|
if message.user_cardname:
|
||||||
|
sender_name=f"[({message.user_id}){message.user_nickname}]{message.user_cardname}"
|
||||||
|
|
||||||
# 获取关系值
|
# 获取关系值
|
||||||
if relationship_manager.get_relationship(message.user_id):
|
if relationship_manager.get_relationship(message.user_id):
|
||||||
@@ -247,6 +254,8 @@ class LLMResponseGenerator:
|
|||||||
for msg_dict in messages_list:
|
for msg_dict in messages_list:
|
||||||
time_str = time.strftime("%m-%d %H:%M:%S", time.localtime(msg_dict['time']))
|
time_str = time.strftime("%m-%d %H:%M:%S", time.localtime(msg_dict['time']))
|
||||||
display_name = msg_dict.get('user_nickname', f"用户{msg_dict['user_id']}")
|
display_name = msg_dict.get('user_nickname', f"用户{msg_dict['user_id']}")
|
||||||
|
cardname = msg_dict.get('user_cardname', f"用户{msg_dict['user_id']}")
|
||||||
|
display_name = f"[({msg_dict['user_id']}){display_name}]{cardname}"
|
||||||
content = msg_dict.get('processed_plain_text', msg_dict['plain_text'])
|
content = msg_dict.get('processed_plain_text', msg_dict['plain_text'])
|
||||||
|
|
||||||
group_chat += f"[{time_str}] {display_name}: {content}\n"
|
group_chat += f"[{time_str}] {display_name}: {content}\n"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from ...common.database import Database
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
from .config import global_config
|
from .config import global_config
|
||||||
import urllib3
|
import urllib3
|
||||||
from .utils_user import get_user_nickname
|
from .utils_user import get_user_nickname,get_user_cardname
|
||||||
from .utils_cq import parse_cq_code
|
from .utils_cq import parse_cq_code
|
||||||
from .cq_code import cq_code_tool,CQCode
|
from .cq_code import cq_code_tool,CQCode
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ class Message:
|
|||||||
group_id: int = None
|
group_id: int = None
|
||||||
user_id: int = None
|
user_id: int = None
|
||||||
user_nickname: str = None # 用户昵称
|
user_nickname: str = None # 用户昵称
|
||||||
|
user_cardname: str=None # 用户群昵称
|
||||||
group_name: str = None # 群名称
|
group_name: str = None # 群名称
|
||||||
|
|
||||||
message_id: int = None
|
message_id: int = None
|
||||||
@@ -58,6 +59,8 @@ class Message:
|
|||||||
|
|
||||||
if not self.user_nickname:
|
if not self.user_nickname:
|
||||||
self.user_nickname = get_user_nickname(self.user_id)
|
self.user_nickname = get_user_nickname(self.user_id)
|
||||||
|
if not self.user_cardname:
|
||||||
|
self.user_cardname=get_user_cardname(self.user_id)
|
||||||
|
|
||||||
if not self.group_name:
|
if not self.group_name:
|
||||||
self.group_name = self.get_groupname(self.group_id)
|
self.group_name = self.get_groupname(self.group_id)
|
||||||
@@ -71,7 +74,10 @@ class Message:
|
|||||||
)
|
)
|
||||||
#将详细翻译为详细可读文本
|
#将详细翻译为详细可读文本
|
||||||
time_str = time.strftime("%m-%d %H:%M:%S", time.localtime(self.time))
|
time_str = time.strftime("%m-%d %H:%M:%S", time.localtime(self.time))
|
||||||
name = self.user_nickname or f"用户{self.user_id}"
|
try:
|
||||||
|
name = f"[({self.user_id}){self.user_nickname}]{self.user_cardname}"
|
||||||
|
except:
|
||||||
|
name = self.user_nickname or f"用户{self.user_id}"
|
||||||
content = self.processed_plain_text
|
content = self.processed_plain_text
|
||||||
self.detailed_plain_text = f"[{time_str}] {name}: {content}\n"
|
self.detailed_plain_text = f"[{time_str}] {name}: {content}\n"
|
||||||
|
|
||||||
@@ -159,6 +165,7 @@ class Message_Thinking:
|
|||||||
self.group_id = message.group_id
|
self.group_id = message.group_id
|
||||||
self.user_id = message.user_id
|
self.user_id = message.user_id
|
||||||
self.user_nickname = message.user_nickname
|
self.user_nickname = message.user_nickname
|
||||||
|
self.user_cardname = message.user_cardname
|
||||||
self.group_name = message.group_name
|
self.group_name = message.group_name
|
||||||
|
|
||||||
self.message_id = message_id
|
self.message_id = message_id
|
||||||
@@ -167,6 +174,7 @@ class Message_Thinking:
|
|||||||
self.thinking_text = "正在思考..."
|
self.thinking_text = "正在思考..."
|
||||||
self.time = int(time.time())
|
self.time = int(time.time())
|
||||||
self.thinking_time = 0
|
self.thinking_time = 0
|
||||||
|
self.interupt=False
|
||||||
|
|
||||||
def update_thinking_time(self):
|
def update_thinking_time(self):
|
||||||
self.thinking_time = round(time.time(), 2) - self.time
|
self.thinking_time = round(time.time(), 2) - self.time
|
||||||
|
|||||||
@@ -183,7 +183,11 @@ class MessageSendControl:
|
|||||||
if isinstance(message, Message_Thinking):
|
if isinstance(message, Message_Thinking):
|
||||||
message.update_thinking_time()
|
message.update_thinking_time()
|
||||||
thinking_time = message.thinking_time
|
thinking_time = message.thinking_time
|
||||||
if thinking_time < 90: # 最少思考2秒
|
if message.interupt:
|
||||||
|
print(f"\033[1;34m[调试]\033[0m 思考不打算回复,移除")
|
||||||
|
queue.get_earliest_message()
|
||||||
|
return
|
||||||
|
elif thinking_time < 90: # 最少思考2秒
|
||||||
if int(thinking_time) % 15 == 0:
|
if int(thinking_time) % 15 == 0:
|
||||||
print(f"\033[1;34m[调试]\033[0m 消息正在思考中,已思考{thinking_time:.1f}秒")
|
print(f"\033[1;34m[调试]\033[0m 消息正在思考中,已思考{thinking_time:.1f}秒")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ class MessageStream:
|
|||||||
"time": 1,
|
"time": 1,
|
||||||
"user_id": 1,
|
"user_id": 1,
|
||||||
"user_nickname": 1,
|
"user_nickname": 1,
|
||||||
|
"user_cardname": 1,
|
||||||
"message_id": 1,
|
"message_id": 1,
|
||||||
"raw_message": 1,
|
"raw_message": 1,
|
||||||
"processed_text": 1
|
"processed_text": 1
|
||||||
@@ -147,6 +148,7 @@ class MessageStream:
|
|||||||
time=msg_data["time"],
|
time=msg_data["time"],
|
||||||
user_id=msg_data["user_id"],
|
user_id=msg_data["user_id"],
|
||||||
user_nickname=msg_data.get("user_nickname", ""),
|
user_nickname=msg_data.get("user_nickname", ""),
|
||||||
|
user_cardname=msg_data.get("user_cardname", ""),
|
||||||
message_id=msg_data["message_id"],
|
message_id=msg_data["message_id"],
|
||||||
raw_message=msg_data["raw_message"],
|
raw_message=msg_data["raw_message"],
|
||||||
processed_plain_text=msg_data.get("processed_text", ""),
|
processed_plain_text=msg_data.get("processed_text", ""),
|
||||||
|
|||||||
@@ -147,14 +147,15 @@ class PromptBuilder:
|
|||||||
is_bot_prompt = ''
|
is_bot_prompt = ''
|
||||||
|
|
||||||
#人格选择
|
#人格选择
|
||||||
|
personality=global_config.PROMPT_PERSONALITY
|
||||||
prompt_personality = ''
|
prompt_personality = ''
|
||||||
personality_choice = random.random()
|
personality_choice = random.random()
|
||||||
if personality_choice < 4/6: # 第一种人格
|
if personality_choice < 4/6: # 第一种人格
|
||||||
prompt_personality = f'''{activate_prompt}你的网名叫{global_config.BOT_NICKNAME},曾经是一个学习地质的女大学生,现在学习心理学和脑科学,你会刷贴吧,你正在浏览qq群,{promt_info_prompt},
|
prompt_personality = f'''{activate_prompt}你的网名叫{global_config.BOT_NICKNAME},{personality[0]},{promt_info_prompt},
|
||||||
现在请你给出日常且口语化的回复,平淡一些,尽量简短一些。{is_bot_prompt}
|
现在请你给出日常且口语化的回复,平淡一些,尽量简短一些。{is_bot_prompt}
|
||||||
请注意把握群里的聊天内容,不要回复的太有条理,可以有个性。'''
|
请注意把握群里的聊天内容,不要回复的太有条理,可以有个性。'''
|
||||||
elif personality_choice < 1: # 第二种人格
|
elif personality_choice < 1: # 第二种人格
|
||||||
prompt_personality = f'''{activate_prompt}你的网名叫{global_config.BOT_NICKNAME},是一个女大学生,你有黑色头发,你会刷小红书, 你正在浏览qq群,{promt_info_prompt},
|
prompt_personality = f'''{activate_prompt}你的网名叫{global_config.BOT_NICKNAME},{personality[1]},{promt_info_prompt},
|
||||||
|
|
||||||
现在请你给出日常且口语化的回复,请表现你自己的见解,不要一昧迎合,尽量简短一些。{is_bot_prompt}
|
现在请你给出日常且口语化的回复,请表现你自己的见解,不要一昧迎合,尽量简短一些。{is_bot_prompt}
|
||||||
请你表达自己的见解和观点。可以有个性。'''
|
请你表达自己的见解和观点。可以有个性。'''
|
||||||
@@ -189,11 +190,11 @@ class PromptBuilder:
|
|||||||
|
|
||||||
activate_prompt_check=f"以上是群里正在进行的聊天,昵称为 '{sender_name}' 的用户说的:{message_txt}。引起了你的注意,你和他{relation_prompt},你想要{relation_prompt_2},但是这不一定是合适的时机,请你决定是否要回应这条消息。"
|
activate_prompt_check=f"以上是群里正在进行的聊天,昵称为 '{sender_name}' 的用户说的:{message_txt}。引起了你的注意,你和他{relation_prompt},你想要{relation_prompt_2},但是这不一定是合适的时机,请你决定是否要回应这条消息。"
|
||||||
prompt_personality_check = ''
|
prompt_personality_check = ''
|
||||||
extra_check_info=f"请注意把握群里的聊天内容的基础上,综合群内的氛围,例如,和{global_config.BOT_NICKNAME}相关的话题要积极回复,如果是at自己的消息一定要回复,如果自己正在和别人聊天一定要回复,其他话题如果合适搭话也可以回复,如果认为应该回复请输出yes,否则输出no,请注意是决定是否需要回复,而不是编写回复内容,除了yes和no不要输出任何回复内容。"
|
extra_check_info=f"请注意把握群里的聊天内容的基础上,综合群内的氛围,例如,和{global_config.BOT_NICKNAME}相关的话题要积极回复,如果是at自己的消息一定要回复,如果是刚刚理会过的人发送消息,且还在与那个人对话中的话一定要回复,其他话题如果合适搭话也可以回复,如果认为应该回复请输出yes,否则输出no,请注意是决定是否需要回复,而不是编写回复内容,除了yes和no不要输出任何回复内容。"
|
||||||
if personality_choice < 4/6: # 第一种人格
|
if personality_choice < 4/6: # 第一种人格
|
||||||
prompt_personality_check = f'''你的网名叫{global_config.BOT_NICKNAME},曾经是一个学习地质的女大学生,现在学习心理学和脑科学,你会刷贴吧,你正在浏览qq群,{promt_info_prompt} {activate_prompt_check} {extra_check_info}'''
|
prompt_personality_check = f'''你的网名叫{global_config.BOT_NICKNAME},{personality[0]},{promt_info_prompt} {activate_prompt_check} {extra_check_info}'''
|
||||||
elif personality_choice < 1: # 第二种人格
|
elif personality_choice < 1: # 第二种人格
|
||||||
prompt_personality_check = f'''你的网名叫{global_config.BOT_NICKNAME},是一个女大学生,你有黑色头发,你会刷小红书, 你正在浏览qq群,{promt_info_prompt} {activate_prompt_check} {extra_check_info}'''
|
prompt_personality_check = f'''你的网名叫{global_config.BOT_NICKNAME},{personality[1]},{promt_info_prompt} {activate_prompt_check} {extra_check_info}'''
|
||||||
|
|
||||||
prompt_check_if_response=f"{prompt_info}\n{prompt_date}\n{chat_talking_prompt}\n{prompt_personality_check}"
|
prompt_check_if_response=f"{prompt_info}\n{prompt_date}\n{chat_talking_prompt}\n{prompt_personality_check}"
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class MessageStorage:
|
|||||||
"processed_plain_text": message.processed_plain_text,
|
"processed_plain_text": message.processed_plain_text,
|
||||||
"time": message.time,
|
"time": message.time,
|
||||||
"user_nickname": message.user_nickname,
|
"user_nickname": message.user_nickname,
|
||||||
|
"user_cardname": message.user_cardname,
|
||||||
"group_name": message.group_name,
|
"group_name": message.group_name,
|
||||||
"topic": topic,
|
"topic": topic,
|
||||||
"detailed_plain_text": message.detailed_plain_text,
|
"detailed_plain_text": message.detailed_plain_text,
|
||||||
@@ -37,6 +38,7 @@ class MessageStorage:
|
|||||||
"processed_plain_text": '[表情包]',
|
"processed_plain_text": '[表情包]',
|
||||||
"time": message.time,
|
"time": message.time,
|
||||||
"user_nickname": message.user_nickname,
|
"user_nickname": message.user_nickname,
|
||||||
|
"user_cardname": message.user_cardname,
|
||||||
"group_name": message.group_name,
|
"group_name": message.group_name,
|
||||||
"topic": topic,
|
"topic": topic,
|
||||||
"detailed_plain_text": message.detailed_plain_text,
|
"detailed_plain_text": message.detailed_plain_text,
|
||||||
|
|||||||
@@ -110,7 +110,11 @@ def get_cloest_chat_from_db(db, length: int, timestamp: str):
|
|||||||
chat_record = list(db.db.messages.find({"time": {"$gt": closest_time}, "group_id": group_id}).sort('time', 1).limit(length))
|
chat_record = list(db.db.messages.find({"time": {"$gt": closest_time}, "group_id": group_id}).sort('time', 1).limit(length))
|
||||||
for record in chat_record:
|
for record in chat_record:
|
||||||
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
||||||
chat_text += f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
|
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 chat_text
|
||||||
|
|
||||||
return [] # 如果没有找到记录,返回空列表
|
return [] # 如果没有找到记录,返回空列表
|
||||||
@@ -170,6 +174,7 @@ def get_recent_group_detailed_plain_text(db, group_id: int, limit: int = 12,comb
|
|||||||
"time": 1, # 返回时间字段
|
"time": 1, # 返回时间字段
|
||||||
"user_id": 1, # 返回用户ID字段
|
"user_id": 1, # 返回用户ID字段
|
||||||
"user_nickname": 1, # 返回用户昵称字段
|
"user_nickname": 1, # 返回用户昵称字段
|
||||||
|
"user_cardname": 1, #返回用户群昵称
|
||||||
"message_id": 1, # 返回消息ID字段
|
"message_id": 1, # 返回消息ID字段
|
||||||
"detailed_plain_text": 1 # 返回处理后的文本字段
|
"detailed_plain_text": 1 # 返回处理后的文本字段
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,9 @@ def get_user_nickname(user_id: int) -> str:
|
|||||||
if int(user_id) == int(global_config.BOT_QQ):
|
if int(user_id) == int(global_config.BOT_QQ):
|
||||||
return global_config.BOT_NICKNAME
|
return global_config.BOT_NICKNAME
|
||||||
# print(user_id)
|
# print(user_id)
|
||||||
return relationship_manager.get_name(user_id)
|
return relationship_manager.get_name(user_id)
|
||||||
|
def get_user_cardname(user_id: int) -> str:
|
||||||
|
if int(user_id) == int(global_config.BOT_QQ):
|
||||||
|
return global_config.BOT_NICKNAME
|
||||||
|
# print(user_id)
|
||||||
|
return ''
|
||||||
@@ -111,7 +111,11 @@ class Memory_graph:
|
|||||||
chat_record = list(self.db.db.messages.find({"time": {"$gt": closest_time}, "group_id": group_id}).sort('time', 1).limit(length))
|
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:
|
for record in chat_record:
|
||||||
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
||||||
chat_text += f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
|
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 chat_text
|
||||||
|
|
||||||
return [] # 如果没有找到记录,返回空列表
|
return [] # 如果没有找到记录,返回空列表
|
||||||
|
|||||||
@@ -112,7 +112,11 @@ class Memory_graph:
|
|||||||
chat_record = list(self.db.db.messages.find({"time": {"$gt": closest_time}, "group_id": group_id}).sort('time', 1).limit(length))
|
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:
|
for record in chat_record:
|
||||||
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
time_str = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(record['time'])))
|
||||||
chat_text += f'[{time_str}] {record["user_nickname"] or "用户" + str(record["user_id"])}: {record["processed_plain_text"]}\n' # 添加发送者和时间信息
|
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 chat_text
|
||||||
|
|
||||||
return [] # 如果没有找到记录,返回空列表
|
return [] # 如果没有找到记录,返回空列表
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ScheduleGenerator:
|
|||||||
|
|
||||||
elif read_only == False:
|
elif read_only == False:
|
||||||
print(f"{date_str}的日程不存在,准备生成新的日程。")
|
print(f"{date_str}的日程不存在,准备生成新的日程。")
|
||||||
prompt = f"""我是{global_config.BOT_NICKNAME},一个曾经学习地质,现在学习心理学和脑科学的女大学生,喜欢刷qq,贴吧,知乎和小红书,请为我生成{date_str}({weekday})的日程安排,包括:
|
prompt = f"""我是{global_config.BOT_NICKNAME},{global_config.PROMPT_SCHEDULE_GEN},请为我生成{date_str}({weekday})的日程安排,包括:
|
||||||
1. 早上的学习和工作安排
|
1. 早上的学习和工作安排
|
||||||
2. 下午的活动和任务
|
2. 下午的活动和任务
|
||||||
3. 晚上的计划和休息时间
|
3. 晚上的计划和休息时间
|
||||||
|
|||||||
Reference in New Issue
Block a user