2024-12-31 00:26:23 +08:00
|
|
|
# Marsho 的类实例以及全局变量
|
|
|
|
from azure.ai.inference.aio import ChatCompletionsClient
|
|
|
|
from azure.core.credentials import AzureKeyCredential
|
|
|
|
from nonebot import get_driver
|
2025-01-26 00:48:55 +08:00
|
|
|
from openai import AsyncOpenAI
|
2024-12-31 00:26:23 +08:00
|
|
|
|
|
|
|
from .config import config
|
|
|
|
from .models import MarshoContext, MarshoTools
|
|
|
|
|
|
|
|
driver = get_driver()
|
|
|
|
|
|
|
|
command_start = driver.config.command_start
|
|
|
|
model_name = config.marshoai_default_model
|
|
|
|
context = MarshoContext()
|
|
|
|
tools = MarshoTools()
|
|
|
|
token = config.marshoai_token
|
|
|
|
endpoint = config.marshoai_azure_endpoint
|
2025-01-26 00:48:55 +08:00
|
|
|
# client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(token))
|
|
|
|
client = AsyncOpenAI(base_url=endpoint, api_key=token)
|
2024-12-31 00:26:23 +08:00
|
|
|
target_list: list[list] = [] # 记录需保存历史上下文的列表
|