Merge branch 'master' of github.com:zhayujie/chatgpt-on-wechat

This commit is contained in:
Saboteur7
2024-10-19 15:55:04 +08:00

View File

@@ -57,7 +57,7 @@ class ChatGPTSession(Session):
def num_tokens_from_messages(messages, model):
"""Returns the number of tokens used by a list of messages."""
if model in ["wenxin", "xunfei", const.GEMINI]:
if model in ["wenxin", "xunfei"] or model.startswith(const.GEMINI):
return num_tokens_by_character(messages)
import tiktoken