Przeglądaj źródła

Merge Pull Request #787 into master

master
lanvent 1 rok temu
rodzic
commit
fceabb8e67
3 zmienionych plików z 7 dodań i 5 usunięć
  1. +4
    -3
      bot/chatgpt/chat_gpt_bot.py
  2. +2
    -2
      bot/chatgpt/chat_gpt_session.py
  3. +1
    -0
      config.py

+ 4
- 3
bot/chatgpt/chat_gpt_bot.py Wyświetl plik

@@ -151,6 +151,7 @@ class AzureChatGPTBot(ChatGPTBot):

def compose_args(self):
args = super().compose_args()
args["engine"] = args["model"]
del(args["model"])
return args
args["deployment_id"] = conf().get("azure_deployment_id")
#args["engine"] = args["model"]
#del(args["model"])
return args

+ 2
- 2
bot/chatgpt/chat_gpt_session.py Wyświetl plik

@@ -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
return num_tokens

+ 1
- 0
config.py Wyświetl plik

@@ -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"], # 私聊时文本需要包含该前缀才能触发机器人回复


Ładowanie…
Anuluj
Zapisz