diff --git a/bot/chatgpt/chat_gpt_bot.py b/bot/chatgpt/chat_gpt_bot.py index 158392d..b7b86a6 100644 --- a/bot/chatgpt/chat_gpt_bot.py +++ b/bot/chatgpt/chat_gpt_bot.py @@ -151,6 +151,7 @@ class AzureChatGPTBot(ChatGPTBot): def compose_args(self): args = super().compose_args() - args["engine"] = args["model"] - del(args["model"]) - return args \ No newline at end of file + args["deployment_id"] = conf().get("azure_deployment_id") + #args["engine"] = args["model"] + #del(args["model"]) + return args diff --git a/bot/chatgpt/chat_gpt_session.py b/bot/chatgpt/chat_gpt_session.py index afbe6a5..90fe064 100644 --- a/bot/chatgpt/chat_gpt_session.py +++ b/bot/chatgpt/chat_gpt_session.py @@ -55,7 +55,7 @@ def num_tokens_from_messages(messages, model): except KeyError: logger.debug("Warning: model not found. Using cl100k_base encoding.") encoding = tiktoken.get_encoding("cl100k_base") - if model == "gpt-3.5-turbo": + if model == "gpt-3.5-turbo" or model == "gpt-35-turbo": return num_tokens_from_messages(messages, model="gpt-3.5-turbo-0301") elif model == "gpt-4": return num_tokens_from_messages(messages, model="gpt-4-0314") @@ -76,4 +76,4 @@ def num_tokens_from_messages(messages, model): if key == "name": num_tokens += tokens_per_name num_tokens += 3 # every reply is primed with <|start|>assistant<|message|> - return num_tokens \ No newline at end of file + return num_tokens diff --git a/config.py b/config.py index 56bff7e..0520eb3 100644 --- a/config.py +++ b/config.py @@ -16,6 +16,7 @@ available_setting = { # chatgpt模型, 当use_azure_chatgpt为true时,其名称为Azure上model deployment名称 "model": "gpt-3.5-turbo", "use_azure_chatgpt": False, # 是否使用azure的chatgpt + "azure_deployment_id": "", #azure 模型部署名称 # Bot触发配置 "single_chat_prefix": ["bot", "@bot"], # 私聊时文本需要包含该前缀才能触发机器人回复