fix: support set_openai_api_key for all channels

This commit is contained in:
lanvent
2023-04-27 20:43:12 +08:00
parent beb7bda243
commit 45b89218de
5 changed files with 6 additions and 12 deletions

View File

@@ -48,6 +48,8 @@ class ChatChannel(Channel):
if first_in: # context首次传入时receiver是None根据类型设置receiver
config = conf()
cmsg = context["msg"]
user_data = conf().get_user_data(cmsg.from_user_id)
context["openai_api_key"] = user_data.get("openai_api_key")
if context.get("isgroup", False):
group_name = cmsg.other_user_nickname
group_id = cmsg.other_user_id