mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-07-31 08:59:51 +00:00
✨ 更新实例和工具模块,更换为OpenAI异步客户端进行聊天请求
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
from azure.ai.inference.aio import ChatCompletionsClient
|
||||
from azure.core.credentials import AzureKeyCredential
|
||||
from nonebot import get_driver
|
||||
from openai import AsyncOpenAI
|
||||
|
||||
from .config import config
|
||||
from .models import MarshoContext, MarshoTools
|
||||
@ -14,5 +15,6 @@ context = MarshoContext()
|
||||
tools = MarshoTools()
|
||||
token = config.marshoai_token
|
||||
endpoint = config.marshoai_azure_endpoint
|
||||
client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(token))
|
||||
# client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(token))
|
||||
client = AsyncOpenAI(base_url=endpoint, api_key=token)
|
||||
target_list: list[list] = [] # 记录需保存历史上下文的列表
|
||||
|
Reference in New Issue
Block a user