2022-12-10 17:43:33 +08:00
|
|
|
|
# 配置文件: 注释里标[必需]的参数必须修改, 其他参数根据需要修改, 但请勿删除
|
2022-12-09 00:01:49 +08:00
|
|
|
|
import logging
|
|
|
|
|
|
2023-04-21 17:51:58 +08:00
|
|
|
|
# 消息处理协议适配器
|
|
|
|
|
# 目前支持以下适配器:
|
2023-04-24 15:46:26 +08:00
|
|
|
|
# - "yirimirai": mirai的通信框架,YiriMirai框架适配器, 请同时填写下方mirai_http_api_config
|
|
|
|
|
# - "nakuru": go-cqhttp通信框架,请同时填写下方nakuru_config
|
2023-04-21 17:51:58 +08:00
|
|
|
|
msg_source_adapter = "yirimirai"
|
|
|
|
|
|
2023-04-23 09:31:35 +08:00
|
|
|
|
# [必需(与nakuru二选一,取决于msg_source_adapter)] Mirai的配置
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# 请到配置mirai的步骤中的教程查看每个字段的信息
|
2022-12-20 22:29:24 +08:00
|
|
|
|
# adapter: 选择适配器,目前支持HTTPAdapter和WebSocketAdapter
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# host: 运行mirai的主机地址
|
|
|
|
|
# port: 运行mirai的主机端口
|
|
|
|
|
# verifyKey: mirai-api-http的verifyKey
|
|
|
|
|
# qq: 机器人的QQ号
|
2023-01-02 12:06:12 +08:00
|
|
|
|
#
|
|
|
|
|
# 注意: QQ机器人配置不支持热重载及热更新
|
2022-12-07 16:48:32 +08:00
|
|
|
|
mirai_http_api_config = {
|
2022-12-21 14:17:57 +08:00
|
|
|
|
"adapter": "WebSocketAdapter",
|
2022-12-11 20:35:52 +08:00
|
|
|
|
"host": "localhost",
|
2022-12-08 12:06:04 +08:00
|
|
|
|
"port": 8080,
|
2022-12-11 20:35:52 +08:00
|
|
|
|
"verifyKey": "yirimirai",
|
|
|
|
|
"qq": 1234567890
|
2022-12-07 16:48:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-23 09:31:35 +08:00
|
|
|
|
# [必需(与mirai二选一,取决于msg_source_adapter)]
|
|
|
|
|
# 使用nakuru-project框架连接go-cqhttp的配置
|
|
|
|
|
nakuru_config = {
|
|
|
|
|
"host": "localhost", # go-cqhttp的地址
|
|
|
|
|
"port": 6700, # go-cqhttp的正向websocket端口
|
|
|
|
|
"http_port": 5700, # go-cqhttp的正向http端口
|
|
|
|
|
"token": "" # 若在go-cqhttp的config.yml设置了access_token, 则填写此处
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-10 17:43:33 +08:00
|
|
|
|
# [必需] OpenAI的配置
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# api_key: OpenAI的API Key
|
2023-03-03 14:12:53 +08:00
|
|
|
|
# http_proxy: 请求OpenAI时使用的代理,None为不使用,https和socks5暂不能使用
|
2022-12-15 17:52:41 +08:00
|
|
|
|
# 若只有一个api-key,请直接修改以下内容中的"openai_api_key"为你的api-key
|
2023-02-10 19:03:25 +08:00
|
|
|
|
#
|
2022-12-15 17:52:41 +08:00
|
|
|
|
# 如准备了多个api-key,可以以字典的形式填写,程序会自动选择可用的api-key
|
2023-01-31 12:48:55 +08:00
|
|
|
|
# 例如
|
|
|
|
|
# openai_config = {
|
|
|
|
|
# "api_key": {
|
|
|
|
|
# "default": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# "key1": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# "key2": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# },
|
2023-03-03 14:12:53 +08:00
|
|
|
|
# "http_proxy": "http://127.0.0.1:12345"
|
2023-01-31 12:48:55 +08:00
|
|
|
|
# }
|
2023-03-26 21:50:43 +08:00
|
|
|
|
#
|
|
|
|
|
# 现已支持反向代理,可以添加reverse_proxy字段以使用反向代理
|
|
|
|
|
# 使用反向代理可以在国内使用OpenAI的API,反向代理的配置请参考
|
|
|
|
|
# https://github.com/Ice-Hazymoon/openai-scf-proxy
|
|
|
|
|
#
|
|
|
|
|
# 反向代理填写示例:
|
|
|
|
|
# openai_config = {
|
|
|
|
|
# "api_key": {
|
|
|
|
|
# "default": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# "key1": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# "key2": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
|
|
|
# },
|
2023-03-26 22:50:03 +08:00
|
|
|
|
# "reverse_proxy": "http://example.com:12345/v1"
|
2023-03-26 21:50:43 +08:00
|
|
|
|
# }
|
2022-12-07 16:48:32 +08:00
|
|
|
|
openai_config = {
|
2022-12-15 17:52:41 +08:00
|
|
|
|
"api_key": {
|
2023-02-09 21:02:07 +08:00
|
|
|
|
"default": "openai_api_key"
|
2022-12-15 17:52:41 +08:00
|
|
|
|
},
|
2023-03-26 21:50:43 +08:00
|
|
|
|
"http_proxy": None,
|
|
|
|
|
"reverse_proxy": None
|
2022-12-07 16:48:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-04 15:21:31 +08:00
|
|
|
|
# api-key切换策略
|
|
|
|
|
# active:每次请求时都会切换api-key
|
2023-08-04 17:10:03 +08:00
|
|
|
|
# passive:仅当api-key超额时才会切换api-key
|
2023-08-04 15:21:31 +08:00
|
|
|
|
switch_strategy = "active"
|
|
|
|
|
|
2023-01-05 18:08:18 +08:00
|
|
|
|
# [必需] 管理员QQ号,用于接收报错等通知及执行管理员级别指令
|
2023-02-25 15:39:31 +08:00
|
|
|
|
# 支持多个管理员,可以使用list形式设置,例如:
|
|
|
|
|
# admin_qq = [12345678, 87654321]
|
2023-01-02 13:06:48 +08:00
|
|
|
|
admin_qq = 0
|
|
|
|
|
|
2022-12-26 23:30:37 +08:00
|
|
|
|
# 情景预设(机器人人格)
|
2022-12-12 17:21:37 +08:00
|
|
|
|
# 每个会话的预设信息,影响所有会话,无视指令重置
|
2022-12-12 14:00:50 +08:00
|
|
|
|
# 可以通过这个字段指定某些情况的回复,可直接用自然语言描述指令
|
2023-02-19 11:46:12 +08:00
|
|
|
|
# 例如:
|
|
|
|
|
# default_prompt = "如果我之后想获取帮助,请你说“输入!help获取帮助”"
|
2022-12-12 22:18:29 +08:00
|
|
|
|
# 这样用户在不知所措的时候机器人就会提示其输入!help获取帮助
|
2022-12-12 17:21:37 +08:00
|
|
|
|
# 可参考 https://github.com/PlexPt/awesome-chatgpt-prompts-zh
|
2023-02-19 11:46:12 +08:00
|
|
|
|
#
|
|
|
|
|
# 如果需要多个情景预设,并在运行期间方便切换,请使用字典的形式填写,例如
|
|
|
|
|
# default_prompt = {
|
|
|
|
|
# "default": "如果我之后想获取帮助,请你说“输入!help获取帮助”",
|
|
|
|
|
# "linux-terminal": "我想让你充当 Linux 终端。我将输入命令,您将回复终端应显示的内容。",
|
|
|
|
|
# "en-dict": "我想让你充当英英词典,对于给出的英文单词,你要给出其中文意思以及英文解释,并且给出一个例句,此外不要有其他反馈。",
|
|
|
|
|
# }
|
|
|
|
|
#
|
|
|
|
|
# 在使用期间即可通过指令:
|
|
|
|
|
# !reset [名称]
|
|
|
|
|
# 来使用指定的情景预设重置会话
|
|
|
|
|
# 例如:
|
|
|
|
|
# !reset linux-terminal
|
|
|
|
|
# 若不指定名称,则使用默认情景预设
|
|
|
|
|
#
|
|
|
|
|
# 也可以使用指令:
|
|
|
|
|
# !default <名称>
|
|
|
|
|
# 将指定的情景预设设置为默认情景预设
|
|
|
|
|
# 例如:
|
|
|
|
|
# !default linux-terminal
|
|
|
|
|
# 之后的会话重置时若不指定名称,则使用linux-terminal情景预设
|
2023-02-25 17:10:30 +08:00
|
|
|
|
#
|
|
|
|
|
# 还可以加载文件中的预设文字,使用方法请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E9%A2%84%E8%AE%BE%E6%96%87%E5%AD%97
|
2023-02-19 11:46:12 +08:00
|
|
|
|
default_prompt = {
|
|
|
|
|
"default": "如果我之后想获取帮助,请你说“输入!help获取帮助”",
|
|
|
|
|
}
|
2022-12-12 14:00:50 +08:00
|
|
|
|
|
2023-03-13 10:31:21 +08:00
|
|
|
|
# 情景预设格式
|
2023-03-24 20:02:50 +08:00
|
|
|
|
# 参考值:默认方式:normal | 完整情景:full_scenario
|
2023-03-26 21:40:21 +08:00
|
|
|
|
# 默认方式 的格式为上述default_prompt中的内容,或prompts目录下的文件名
|
|
|
|
|
# 完整情景方式 的格式为JSON,在scenario目录下的JSON文件中列出对话的每个回合,编写方法见scenario/default-template.json
|
|
|
|
|
# 编写方法请查看:https://github.com/RockChinQ/QChatGPT/wiki/%E5%8A%9F%E8%83%BD%E4%BD%BF%E7%94%A8#%E9%A2%84%E8%AE%BE%E6%96%87%E5%AD%97full_scenario%E6%A8%A1%E5%BC%8F
|
2023-03-24 20:02:50 +08:00
|
|
|
|
preset_mode = "normal"
|
2023-03-09 15:52:18 +08:00
|
|
|
|
|
2022-12-19 16:47:13 +08:00
|
|
|
|
# 群内响应规则
|
|
|
|
|
# 符合此消息的群内消息即使不包含at机器人也会响应
|
|
|
|
|
# 支持消息前缀匹配及正则表达式匹配
|
2023-03-06 17:50:34 +08:00
|
|
|
|
# 支持设置是否响应at消息、随机响应概率
|
2023-01-05 21:09:03 +08:00
|
|
|
|
# 注意:由消息前缀(prefix)匹配的消息中将会删除此前缀,正则表达式(regexp)匹配的消息不会删除匹配的部分
|
2022-12-19 16:47:13 +08:00
|
|
|
|
# 前缀匹配优先级高于正则表达式匹配
|
|
|
|
|
# 正则表达式简明教程:https://www.runoob.com/regexp/regexp-tutorial.html
|
2023-04-25 09:28:31 +08:00
|
|
|
|
#
|
|
|
|
|
# 支持针对不同群设置不同的响应规则,例如:
|
|
|
|
|
# response_rules = {
|
|
|
|
|
# "default": {
|
|
|
|
|
# "at": True,
|
|
|
|
|
# "prefix": ["/ai", "!ai", "!ai", "ai"],
|
|
|
|
|
# "regexp": [],
|
|
|
|
|
# "random_rate": 0.0,
|
|
|
|
|
# },
|
|
|
|
|
# "12345678": {
|
|
|
|
|
# "at": False,
|
|
|
|
|
# "prefix": ["/ai", "!ai", "!ai", "ai"],
|
|
|
|
|
# "regexp": [],
|
|
|
|
|
# "random_rate": 0.0,
|
|
|
|
|
# },
|
|
|
|
|
# }
|
|
|
|
|
#
|
|
|
|
|
# 以上设置将会在群号为12345678的群中关闭at响应
|
|
|
|
|
# 未单独设置的群将使用default规则
|
2022-12-19 16:47:13 +08:00
|
|
|
|
response_rules = {
|
2023-04-25 09:28:31 +08:00
|
|
|
|
"default": {
|
|
|
|
|
"at": True, # 是否响应at机器人的消息
|
|
|
|
|
"prefix": ["/ai", "!ai", "!ai", "ai"],
|
|
|
|
|
"regexp": [], # "为什么.*", "怎么?样.*", "怎么.*", "如何.*", "[Hh]ow to.*", "[Ww]hy not.*", "[Ww]hat is.*", ".*怎么办", ".*咋办"
|
|
|
|
|
"random_rate": 0.0, # 随机响应概率,0.0-1.0,0.0为不随机响应,1.0为响应所有消息, 仅在前几项判断不通过时生效
|
|
|
|
|
},
|
2022-12-19 16:47:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-25 09:28:31 +08:00
|
|
|
|
|
2023-02-23 10:02:55 +08:00
|
|
|
|
# 消息忽略规则
|
|
|
|
|
# 适用于私聊及群聊
|
|
|
|
|
# 符合此规则的消息将不会被响应
|
|
|
|
|
# 支持消息前缀匹配及正则表达式匹配
|
|
|
|
|
# 此设置优先级高于response_rules
|
|
|
|
|
# 用以过滤mirai等其他层级的指令
|
|
|
|
|
# @see https://github.com/RockChinQ/QChatGPT/issues/165
|
|
|
|
|
ignore_rules = {
|
|
|
|
|
"prefix": ["/"],
|
|
|
|
|
"regexp": []
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-05 10:49:07 +08:00
|
|
|
|
# 是否检查收到的消息中是否包含敏感词
|
|
|
|
|
# 若收到的消息无法通过下方指定的敏感词检查策略,则发送提示信息
|
|
|
|
|
income_msg_check = False
|
|
|
|
|
|
2022-12-19 16:07:02 +08:00
|
|
|
|
# 敏感词过滤开关,以同样数量的*代替敏感词回复
|
|
|
|
|
# 请在sensitive.json中添加敏感词
|
|
|
|
|
sensitive_word_filter = True
|
|
|
|
|
|
2023-03-05 10:12:49 +08:00
|
|
|
|
# 是否启用百度云内容安全审核
|
|
|
|
|
# 注册方式查看 https://cloud.baidu.com/doc/ANTIPORN/s/Wkhu9d5iy
|
2023-03-04 21:12:50 +08:00
|
|
|
|
baidu_check = False
|
2023-03-04 21:02:10 +08:00
|
|
|
|
|
2023-03-05 10:12:49 +08:00
|
|
|
|
# 百度云API_KEY 24位英文数字字符串
|
2023-03-04 21:02:10 +08:00
|
|
|
|
baidu_api_key = ""
|
|
|
|
|
|
2023-03-05 10:12:49 +08:00
|
|
|
|
# 百度云SECRET_KEY 32位的英文数字字符串
|
|
|
|
|
baidu_secret_key = ""
|
2023-03-04 21:02:10 +08:00
|
|
|
|
|
2023-03-05 10:12:49 +08:00
|
|
|
|
# 不合规消息自定义返回
|
2023-03-05 01:17:23 +08:00
|
|
|
|
inappropriate_message_tips = "[百度云]请珍惜机器人,当前返回内容不合规"
|
2023-03-04 21:02:10 +08:00
|
|
|
|
|
2023-02-10 19:03:25 +08:00
|
|
|
|
# 启动时是否发送赞赏码
|
|
|
|
|
# 仅当使用量已经超过2048字时发送
|
|
|
|
|
encourage_sponsor_at_start = True
|
|
|
|
|
|
2022-12-19 16:07:02 +08:00
|
|
|
|
# 每次向OpenAI接口发送对话记录上下文的字符数
|
2023-02-13 17:21:23 +08:00
|
|
|
|
# 最大不超过(4096 - max_tokens)个字符,max_tokens为下方completion_api_params中的max_tokens
|
2022-12-19 16:07:02 +08:00
|
|
|
|
# 注意:较大的prompt_submit_length会导致OpenAI账户额度消耗更快
|
2023-03-19 16:32:34 +08:00
|
|
|
|
prompt_submit_length = 2048
|
2022-12-19 16:07:02 +08:00
|
|
|
|
|
2023-06-08 13:20:33 +08:00
|
|
|
|
# 是否在token超限报错时自动重置会话
|
|
|
|
|
# 可在tips.py中编辑提示语
|
|
|
|
|
auto_reset = True
|
|
|
|
|
|
2023-03-03 00:23:44 +08:00
|
|
|
|
# OpenAI补全API的参数
|
|
|
|
|
# 请在下方填写模型,程序自动选择接口
|
|
|
|
|
# 现已支持的模型有:
|
|
|
|
|
#
|
2023-03-18 12:38:48 +08:00
|
|
|
|
# 'gpt-4'
|
2023-06-16 19:35:06 +08:00
|
|
|
|
# 'gpt-4-0613'
|
2023-03-18 12:38:48 +08:00
|
|
|
|
# 'gpt-4-32k'
|
2023-06-16 19:35:06 +08:00
|
|
|
|
# 'gpt-4-32k-0613'
|
2023-03-03 00:23:44 +08:00
|
|
|
|
# 'gpt-3.5-turbo'
|
2023-06-16 19:35:06 +08:00
|
|
|
|
# 'gpt-3.5-turbo-16k'
|
|
|
|
|
# 'gpt-3.5-turbo-0613'
|
|
|
|
|
# 'gpt-3.5-turbo-16k-0613'
|
2023-03-03 00:23:44 +08:00
|
|
|
|
# 'text-davinci-003'
|
|
|
|
|
# 'text-davinci-002'
|
|
|
|
|
# 'code-davinci-002'
|
|
|
|
|
# 'code-cushman-001'
|
|
|
|
|
# 'text-curie-001'
|
|
|
|
|
# 'text-babbage-001'
|
|
|
|
|
# 'text-ada-001'
|
|
|
|
|
#
|
2022-12-19 16:07:02 +08:00
|
|
|
|
# 具体请查看OpenAI的文档: https://beta.openai.com/docs/api-reference/completions/create
|
2023-03-20 14:46:39 +08:00
|
|
|
|
# 请将内容修改到config.py中,请勿修改config-template.py
|
2022-12-07 16:48:32 +08:00
|
|
|
|
completion_api_params = {
|
2023-03-03 00:25:26 +08:00
|
|
|
|
"model": "gpt-3.5-turbo",
|
2023-02-10 19:03:25 +08:00
|
|
|
|
"temperature": 0.9, # 数值越低得到的回答越理性,取值范围[0, 1]
|
2022-12-10 17:43:33 +08:00
|
|
|
|
"top_p": 1, # 生成的文本的文本与要求的符合度, 取值范围[0, 1]
|
2022-12-09 23:30:44 +08:00
|
|
|
|
"frequency_penalty": 0.2,
|
2022-12-19 16:07:02 +08:00
|
|
|
|
"presence_penalty": 1.0,
|
2022-12-07 22:27:05 +08:00
|
|
|
|
}
|
2022-12-07 22:50:49 +08:00
|
|
|
|
|
2022-12-27 22:52:53 +08:00
|
|
|
|
# OpenAI的Image API的参数
|
|
|
|
|
# 具体请查看OpenAI的文档: https://beta.openai.com/docs/api-reference/images/create
|
|
|
|
|
image_api_params = {
|
2022-12-28 00:05:25 +08:00
|
|
|
|
"size": "256x256", # 图片尺寸,支持256x256, 512x512, 1024x1024
|
2022-12-27 22:52:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-05 21:44:11 +08:00
|
|
|
|
# 跟踪函数调用
|
|
|
|
|
# 为True时,在每次GPT进行Function Calling时都会输出发送一条回复给用户
|
|
|
|
|
# 同时,一次提问内所有的Function Calling和普通回复消息都会单独发送给用户
|
2023-08-06 14:40:35 +08:00
|
|
|
|
trace_function_calls = False
|
2023-08-05 21:44:11 +08:00
|
|
|
|
|
2023-01-27 13:59:49 +08:00
|
|
|
|
# 群内回复消息时是否引用原消息
|
2023-01-01 17:20:54 +08:00
|
|
|
|
quote_origin = True
|
|
|
|
|
|
2023-08-01 10:13:15 +08:00
|
|
|
|
# 群内回复消息时是否at发送者
|
|
|
|
|
at_sender = False
|
|
|
|
|
|
2023-01-01 17:20:54 +08:00
|
|
|
|
# 回复绘图时是否包含图片描述
|
|
|
|
|
include_image_description = True
|
|
|
|
|
|
2022-12-10 17:39:02 +08:00
|
|
|
|
# 消息处理的超时时间,单位为秒
|
2023-01-07 23:24:13 +08:00
|
|
|
|
process_message_timeout = 30
|
2022-12-07 23:37:52 +08:00
|
|
|
|
|
2022-12-19 16:07:02 +08:00
|
|
|
|
# 回复消息时是否显示[GPT]前缀
|
|
|
|
|
show_prefix = False
|
|
|
|
|
|
2023-05-18 20:10:08 +08:00
|
|
|
|
# 回复前的强制延迟时间,降低机器人被腾讯风控概率
|
|
|
|
|
# *此机制对命令和消息、私聊及群聊均生效
|
|
|
|
|
# 每次处理时从以下的范围取一个随机秒数,
|
|
|
|
|
# 当此次消息处理时间低于此秒数时,将会强制延迟至此秒数
|
2023-05-18 20:13:53 +08:00
|
|
|
|
# 例如:[1.5, 3],则每次处理时会随机取一个1.5-3秒的随机数,若处理时间低于此随机数,则强制延迟至此随机秒数
|
2023-05-18 20:10:08 +08:00
|
|
|
|
# 若您不需要此功能,请将force_delay_range设置为[0, 0]
|
2023-05-18 20:13:53 +08:00
|
|
|
|
force_delay_range = [1.5, 3]
|
2023-05-18 20:10:08 +08:00
|
|
|
|
|
2023-03-04 10:36:43 +08:00
|
|
|
|
# 应用长消息处理策略的阈值
|
|
|
|
|
# 当回复消息长度超过此值时,将使用长消息处理策略
|
|
|
|
|
blob_message_threshold = 256
|
|
|
|
|
|
|
|
|
|
# 长消息处理策略
|
|
|
|
|
# - "image": 将长消息转换为图片发送
|
|
|
|
|
# - "forward": 将长消息转换为转发消息组件发送
|
|
|
|
|
blob_message_strategy = "forward"
|
|
|
|
|
|
2023-04-15 17:33:57 +08:00
|
|
|
|
# 允许等待
|
|
|
|
|
# 同一会话内,是否等待上一条消息处理完成后再处理下一条消息
|
|
|
|
|
# 若设置为False,若上一条未处理完时收到了新消息,将会丢弃新消息
|
|
|
|
|
# 丢弃消息时的提示信息可以在tips.py中修改
|
|
|
|
|
wait_last_done = True
|
|
|
|
|
|
2023-03-05 19:36:09 +08:00
|
|
|
|
# 文字转图片时使用的字体文件路径
|
|
|
|
|
# 当策略为"image"时生效
|
|
|
|
|
# 若在Windows系统下,程序会自动使用Windows自带的微软雅黑字体
|
|
|
|
|
# 若未填写或不存在且不是Windows,将禁用文字转图片功能,改为使用转发消息组件
|
|
|
|
|
font_path = ""
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# 消息处理超时重试次数
|
2022-12-07 23:37:52 +08:00
|
|
|
|
retry_times = 3
|
|
|
|
|
|
2023-02-08 17:06:54 +08:00
|
|
|
|
# 消息处理出错时是否向用户隐藏错误详细信息
|
|
|
|
|
# 设置为True时,仅向管理员发送错误详细信息
|
|
|
|
|
# 设置为False时,向用户及管理员发送错误详细信息
|
|
|
|
|
hide_exce_info_to_user = False
|
|
|
|
|
|
2023-03-23 21:09:40 +08:00
|
|
|
|
# 线程池相关配置
|
2023-03-05 16:41:12 +08:00
|
|
|
|
# 该参数决定机器人可以同时处理几个人的消息,超出线程池数量的请求会被阻塞,不会被丢弃
|
|
|
|
|
# 如果你不清楚该参数的意义,请不要更改
|
2023-03-23 21:09:40 +08:00
|
|
|
|
# 程序运行本身线程池,无代码层面修改请勿更改
|
|
|
|
|
sys_pool_num = 8
|
|
|
|
|
|
|
|
|
|
# 执行管理员请求和指令的线程池并行线程数量,一般和管理员数量相等
|
2023-04-15 17:33:57 +08:00
|
|
|
|
admin_pool_num = 4
|
2023-03-23 21:09:40 +08:00
|
|
|
|
|
|
|
|
|
# 执行用户请求和指令的线程池并行线程数量
|
|
|
|
|
# 如需要更高的并发,可以增大该值
|
2023-04-15 17:33:57 +08:00
|
|
|
|
user_pool_num = 8
|
2023-03-05 16:41:12 +08:00
|
|
|
|
|
2022-12-10 17:39:02 +08:00
|
|
|
|
# 每个会话的过期时间,单位为秒
|
2022-12-09 00:01:49 +08:00
|
|
|
|
# 默认值20分钟
|
2023-04-08 15:36:35 +08:00
|
|
|
|
session_expire_time = 1200
|
2022-12-09 00:01:49 +08:00
|
|
|
|
|
2023-02-25 00:27:14 +08:00
|
|
|
|
# 会话限速
|
|
|
|
|
# 单会话内每分钟可进行的对话次数
|
|
|
|
|
# 若不需要限速,可以设置为一个很大的值
|
|
|
|
|
# 默认值60次,基本上不会触发限速
|
2023-04-14 19:44:03 +08:00
|
|
|
|
#
|
|
|
|
|
# 若要设置针对某特定群的限速,请使用如下格式:
|
|
|
|
|
# {
|
|
|
|
|
# "group_<群号>": 60,
|
|
|
|
|
# "default": 60,
|
|
|
|
|
# }
|
|
|
|
|
# 若要设置针对某特定用户私聊的限速,请使用如下格式:
|
|
|
|
|
# {
|
|
|
|
|
# "person_<用户QQ>": 60,
|
|
|
|
|
# "default": 60,
|
|
|
|
|
# }
|
|
|
|
|
# 同时设置多个群和私聊的限速,示例:
|
|
|
|
|
# {
|
|
|
|
|
# "group_12345678": 60,
|
|
|
|
|
# "group_87654321": 60,
|
|
|
|
|
# "person_234567890": 60,
|
|
|
|
|
# "person_345678901": 60,
|
|
|
|
|
# "default": 60,
|
|
|
|
|
# }
|
|
|
|
|
#
|
|
|
|
|
# 注意: 未指定的都使用default的限速值,default不可删除
|
|
|
|
|
rate_limitation = {
|
|
|
|
|
"default": 60,
|
|
|
|
|
}
|
2023-02-25 00:27:14 +08:00
|
|
|
|
|
|
|
|
|
# 会话限速策略
|
|
|
|
|
# - "wait": 每次对话获取到回复时,等待一定时间再发送回复,保证其不会超过限速均值
|
|
|
|
|
# - "drop": 此分钟内,若对话次数超过限速次数,则丢弃之后的对话,每自然分钟重置
|
2023-04-14 19:44:03 +08:00
|
|
|
|
rate_limit_strategy = "drop"
|
2023-02-25 00:27:14 +08:00
|
|
|
|
|
2023-03-04 10:16:47 +08:00
|
|
|
|
# 是否在启动时进行依赖库更新
|
|
|
|
|
upgrade_dependencies = True
|
|
|
|
|
|
2023-01-04 17:59:10 +08:00
|
|
|
|
# 是否上报统计信息
|
|
|
|
|
# 用于统计机器人的使用情况,不会收集任何用户信息
|
|
|
|
|
# 仅上报时间、字数使用量、绘图使用量,其他信息不会上报
|
|
|
|
|
report_usage = True
|
|
|
|
|
|
2022-12-09 00:01:49 +08:00
|
|
|
|
# 日志级别
|
2022-12-09 15:43:59 +08:00
|
|
|
|
logging_level = logging.INFO
|