diff --git a/config-template.py b/config-template.py index 7ff08d26..23caf4b2 100644 --- a/config-template.py +++ b/config-template.py @@ -33,9 +33,9 @@ mirai_http_api_config = { # }, # "http_proxy": "http://127.0.0.1:12345" # } -# +# # 现已支持反向代理,可以添加reverse_proxy字段以使用反向代理 -# 使用反向代理可以在国内使用OpenAI的API,反向代理的配置请参考 +# 使用反向代理可以在国内使用OpenAI的API,反向代理的配置请参考 # https://github.com/Ice-Hazymoon/openai-scf-proxy # # 反向代理填写示例: @@ -63,7 +63,7 @@ admin_qq = 0 # 情景预设(机器人人格) # 每个会话的预设信息,影响所有会话,无视指令重置 # 可以通过这个字段指定某些情况的回复,可直接用自然语言描述指令 -# 例如: +# 例如: # default_prompt = "如果我之后想获取帮助,请你说“输入!help获取帮助”" # 这样用户在不知所措的时候机器人就会提示其输入!help获取帮助 # 可参考 https://github.com/PlexPt/awesome-chatgpt-prompts-zh @@ -81,14 +81,14 @@ admin_qq = 0 # 例如: # !reset linux-terminal # 若不指定名称,则使用默认情景预设 -# +# # 也可以使用指令: # !default <名称> # 将指定的情景预设设置为默认情景预设 # 例如: # !default linux-terminal # 之后的会话重置时若不指定名称,则使用linux-terminal情景预设 -# +# # 还可以加载文件中的预设文字,使用方法请查看: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 default_prompt = { "default": "如果我之后想获取帮助,请你说“输入!help获取帮助”", @@ -160,7 +160,7 @@ prompt_submit_length = 2048 # OpenAI补全API的参数 # 请在下方填写模型,程序自动选择接口 # 现已支持的模型有: -# +# # 'gpt-4' # 'gpt-4-0314' # 'gpt-4-32k' diff --git a/pkg/openai/manager.py b/pkg/openai/manager.py index 2d64e9a3..1032e3dd 100644 --- a/pkg/openai/manager.py +++ b/pkg/openai/manager.py @@ -48,8 +48,8 @@ class OpenAIInteract: # 根据模型选择使用的接口 ai: ModelRequest = create_openai_model_request( - config.completion_api_params['model'], - 'user', + config.completion_api_params['model'], + 'user', config.openai_config["http_proxy"] if "http_proxy" in config.openai_config else None ) ai.request( diff --git a/pkg/qqbot/command.py b/pkg/qqbot/command.py index 3527c5a8..9081e58e 100644 --- a/pkg/qqbot/command.py +++ b/pkg/qqbot/command.py @@ -32,7 +32,7 @@ def process_command(session_name: str, text_message: str, mgr, config, params = text_message[1:].strip().split(' ')[1:] - # 把!~开头的转换成!cfg + # 把!~开头的转换成!cfg if cmd.startswith('~'): params = [cmd[1:]] + params cmd = 'cfg' diff --git a/pkg/qqbot/filter.py b/pkg/qqbot/filter.py index f0efeda9..fa052a07 100644 --- a/pkg/qqbot/filter.py +++ b/pkg/qqbot/filter.py @@ -50,8 +50,8 @@ class ReplyFilter: # 百度云审核URL baidu_url = "https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined?access_token=" + \ - str(requests.post("https://aip.baidubce.com/oauth/2.0/token", - params={"grant_type": "client_credentials", + str(requests.post("https://aip.baidubce.com/oauth/2.0/token", + params={"grant_type": "client_credentials", "client_id": self.baidu_api_key, "client_secret": self.baidu_secret_key}).json().get("access_token"))