mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-07-31 08:59:51 +00:00
✨ 重构Marsho插件,优化模块导入,钩子函数与类实例化,全局变量独立为模块
This commit is contained in:
18
nonebot_plugin_marshoai/instances.py
Normal file
18
nonebot_plugin_marshoai/instances.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Marsho 的类实例以及全局变量
|
||||
from azure.ai.inference.aio import ChatCompletionsClient
|
||||
from azure.core.credentials import AzureKeyCredential
|
||||
from nonebot import get_driver
|
||||
|
||||
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
|
||||
client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(token))
|
||||
target_list: list[list] = [] # 记录需保存历史上下文的列表
|
Reference in New Issue
Block a user