修改杂项

1
This commit is contained in:
SengokuCola
2025-02-28 10:48:05 +08:00
parent 288e5a87d8
commit 9954d8390c
6 changed files with 11 additions and 84 deletions

View File

@@ -13,9 +13,10 @@
**麦麦qq机器人的源代码仓库** **麦麦qq机器人的源代码仓库**
基于napcat、nonebot和mongodb的专注于群聊天的qqbot 基于llm、napcat、nonebot和mongodb的专注于群聊天的qqbot
> ⚠️ **警告**:代码可能随时更改,目前版本不一定是稳定版本并请自行了解qqbot的风险 > ⚠️ **警告**:代码可能随时更改,目前版本不一定是稳定版本
⚠️ **警告**请自行了解qqbot的风险麦麦有时候一天被腾讯肘七八次
> ⚠️ **警告**由于麦麦一直在迭代所以可能存在一些bug请自行测试包括胡言乱语 > ⚠️ **警告**由于麦麦一直在迭代所以可能存在一些bug请自行测试包括胡言乱语
## 🚀 快速开始 ## 🚀 快速开始
@@ -33,20 +34,21 @@
- 麦麦bot会自动连接默认的mongodb可配置 - 麦麦bot会自动连接默认的mongodb可配置
3. **Napcat配置** 3. **Napcat配置**
- 安装并允许Napcat - 安装并运行Napcat
- 设置ws反向代理:ws://localhost:8080/onebot/v11/ws - 设置ws反向代理:ws://localhost:8080/onebot/v11/ws,启动
4. **配置文件设置** 4. **配置文件设置**
- 把env.example改成.env并填上你的apikey硅基流动 - 把env.example改成.env并填上你的apikey硅基流动或deepseekapi
- 把bot_config_toml改名为bot_config.toml并填写相关内容 - 把bot_config_toml改名为bot_config.toml并填写相关内容
5. **运行麦麦** 5. **运行麦麦**
从 runniuniu.bat 启动 从 run_maimai.bat 启动
run_thingking.bat 可以启动可视化的推理界面
## 🎯 功能介绍 ## 🎯 功能介绍
### 💬 聊天功能 ### 💬 聊天功能
- 支持关键词检索主动发言对消息的话题topic进行识别如果检测到麦麦存储过的话题就会主动进行发言目前有bug - 支持关键词检索主动发言对消息的话题topic进行识别如果检测到麦麦存储过的话题就会主动进行发言目前有bug,所以现在只会检测主题,不会进行存储
- 支持bot名字呼唤发言检测到"麦麦"会主动发言,可配置 - 支持bot名字呼唤发言检测到"麦麦"会主动发言,可配置
- 使用硅基流动的api进行回复生成可随机使用R1V3R1-distill等模型未来将加入官网api支持 - 使用硅基流动的api进行回复生成可随机使用R1V3R1-distill等模型未来将加入官网api支持
- 动态的prompt构建器更拟人 - 动态的prompt构建器更拟人

View File

@@ -53,7 +53,7 @@ class PromptBuilder:
bot_schedule_now_time,bot_schedule_now_activity = bot_schedule.get_current_task() bot_schedule_now_time,bot_schedule_now_activity = bot_schedule.get_current_task()
prompt_date = f'''今天是{current_date},现在是{current_time},你今天的日程是:\n{bot_schedule.today_schedule}\n你现在正在{bot_schedule_now_activity}\n''' prompt_date = f'''今天是{current_date},现在是{current_time},你今天的日程是:\n{bot_schedule.today_schedule}\n你现在正在{bot_schedule_now_activity}\n'''
#知识构建 #知识构建(暂时禁用,因为知识库太少了)
prompt_info = '' prompt_info = ''
promt_info_prompt = '' promt_info_prompt = ''
prompt_info = self.get_prompt_info(message_txt) prompt_info = self.get_prompt_info(message_txt)
@@ -98,7 +98,7 @@ class PromptBuilder:
现在请你给出日常且口语化的回复,请表现你自己的见解,不要一昧迎合,尽量简短一些。{is_bot_prompt} 现在请你给出日常且口语化的回复,请表现你自己的见解,不要一昧迎合,尽量简短一些。{is_bot_prompt}
请你表达自己的见解和观点。可以有个性。''' 请你表达自己的见解和观点。可以有个性。'''
#中文高手 #中文高手(新加的好玩功能)
prompt_ger = '' prompt_ger = ''
if random.random() < 0.04: if random.random() < 0.04:
prompt_ger += '你喜欢用倒装句' prompt_ger += '你喜欢用倒装句'

View File

@@ -1,75 +0,0 @@
import random
text = "我今天很开心 但是也很伤心 但是也很伤心,"
len_text = len(text)
print(f"len_text: {len_text}")
if len_text < 5:
if random.random() < 0.01:
print(f"直接按字符分割")
else:
print(f"直接按字符分割")
if len_text < 15:
split_strength = 0.3
elif len_text < 35:
split_strength = 0.7
else:
split_strength = 0.9
#先移除换行符
print(f"split_strength: {split_strength}")
print(f"处理前的文本: {text}")
# 统一将英文逗号转换为中文逗号
text = text.replace(',', '')
text = text.replace('\n', ' ')
print(f"处理前的文本: {text}")
text_no_1 = ''
for letter in text:
print(f"当前字符: {letter}")
if letter in ['!','','?','']:
print(f"当前字符: {letter}, 随机数: {random.random()}")
if random.random() < split_strength:
letter = ''
if letter in ['','']:
print(f"当前字符: {letter}, 随机数: {random.random()}")
if random.random() < 1 - split_strength:
letter = ''
text_no_1 += letter
# 对每个逗号和空格单独判断是否分割
sentences = [text_no_1]
new_sentences = []
for sentence in sentences:
parts = sentence.split('')
current_sentence = parts[0]
for part in parts[1:]:
if random.random() < split_strength:
new_sentences.append(current_sentence.strip())
current_sentence = part
else:
current_sentence += '' + part
# 处理空格分割
space_parts = current_sentence.split(' ')
current_sentence = space_parts[0]
for part in space_parts[1:]:
if random.random() < split_strength:
new_sentences.append(current_sentence.strip())
current_sentence = part
else:
current_sentence += ' ' + part
new_sentences.append(current_sentence.strip())
sentences = [s for s in new_sentences if s] # 移除空字符串
print(f"分割后的句子: {sentences}")
sentences_done = []
for sentence in sentences:
sentence = sentence.rstrip(',')
if random.random() < split_strength*0.5:
sentence = sentence.replace('', '').replace(',', '')
elif random.random() < split_strength:
sentence = sentence.replace('', ' ').replace(',', ' ')
sentences_done.append(sentence)
print(f"处理后的句子: {sentences_done}")