2022-12-09 00:01:49 +08:00
|
|
|
|
import logging
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# Mirai的配置
|
|
|
|
|
# 请到配置mirai的步骤中的教程查看每个字段的信息
|
|
|
|
|
# host: 运行mirai的主机地址
|
|
|
|
|
# port: 运行mirai的主机端口
|
|
|
|
|
# verifyKey: mirai-api-http的verifyKey
|
|
|
|
|
# qq: 机器人的QQ号
|
2022-12-07 16:48:32 +08:00
|
|
|
|
mirai_http_api_config = {
|
|
|
|
|
"host": "",
|
2022-12-08 12:06:04 +08:00
|
|
|
|
"port": 8080,
|
2022-12-07 16:48:32 +08:00
|
|
|
|
"verifyKey": "",
|
|
|
|
|
"qq": 0
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# MySQL数据库的配置
|
|
|
|
|
# host: 数据库地址
|
|
|
|
|
# port: 数据库端口
|
|
|
|
|
# user: 数据库用户名
|
|
|
|
|
# password: 数据库密码
|
|
|
|
|
# database: 数据库名
|
2022-12-07 16:48:32 +08:00
|
|
|
|
mysql_config = {
|
|
|
|
|
"host": "",
|
|
|
|
|
"port": 3306,
|
|
|
|
|
"user": "",
|
|
|
|
|
"password": "",
|
|
|
|
|
"database": ""
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# OpenAI的配置
|
|
|
|
|
# api_key: OpenAI的API Key
|
2022-12-07 16:48:32 +08:00
|
|
|
|
openai_config = {
|
|
|
|
|
"api_key": "",
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# OpenAI的completion API的参数
|
|
|
|
|
# 不了解的话请不要修改,具体请查看OpenAI的文档
|
2022-12-07 16:48:32 +08:00
|
|
|
|
completion_api_params = {
|
2022-12-07 22:27:05 +08:00
|
|
|
|
"model": "text-davinci-003",
|
2022-12-09 15:43:59 +08:00
|
|
|
|
"temperature": 0.8,
|
|
|
|
|
"max_tokens": 200,
|
2022-12-07 22:27:05 +08:00
|
|
|
|
"top_p": 1,
|
2022-12-09 23:30:44 +08:00
|
|
|
|
"frequency_penalty": 0.2,
|
|
|
|
|
"presence_penalty": 0.4,
|
2022-12-07 22:27:05 +08:00
|
|
|
|
}
|
2022-12-07 22:50:49 +08:00
|
|
|
|
|
2022-12-10 00:33:42 +08:00
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# 消息处理的超时时间
|
2022-12-09 00:01:49 +08:00
|
|
|
|
process_message_timeout = 20
|
2022-12-07 23:37:52 +08:00
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# 消息处理超时重试次数
|
2022-12-07 23:37:52 +08:00
|
|
|
|
retry_times = 3
|
|
|
|
|
|
2022-12-08 14:54:17 +08:00
|
|
|
|
# 每个会话的过期时间
|
2022-12-09 00:01:49 +08:00
|
|
|
|
# 默认值20分钟
|
|
|
|
|
session_expire_time = 60 * 20
|
|
|
|
|
|
|
|
|
|
# 日志级别
|
2022-12-09 15:43:59 +08:00
|
|
|
|
logging_level = logging.INFO
|
2022-12-10 00:33:42 +08:00
|
|
|
|
|
|
|
|
|
# 定制帮助消息
|
|
|
|
|
help_message = """此机器人通过调用OpenAI的GPT-3大型语言模型生成回复,不具有情感。
|
|
|
|
|
你可以用自然语言与其交流,回复的消息中[GPT]开头的为模型生成的语言,[bot]开头的为程序提示。
|
|
|
|
|
了解此项目请找QQ 1010553892 联系作者
|
|
|
|
|
请不要用其生成整篇文章或大段代码,因为每次只会向模型提交少部分文字,生成大部分文字会产生偏题、前后矛盾等问题
|
|
|
|
|
每次会话最后一次交互后{}分钟后会自动结束,结束后将开启新会话,如需继续前一次会话请发送 !last 重新开启
|
|
|
|
|
欢迎到github.com/RockChinQ/QChatGPT 给个star
|
|
|
|
|
|
|
|
|
|
帮助信息:
|
|
|
|
|
!help - 显示帮助
|
|
|
|
|
!reset - 重置会话
|
|
|
|
|
!last - 切换到前一次的对话
|
|
|
|
|
!next - 切换到后一次的对话
|
|
|
|
|
!prompt - 显示当前对话所有内容
|
|
|
|
|
!list - 列出所有历史会话""".format(session_expire_time // 60)
|