mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-27 11:46:35 +08:00
* 实现缓存装饰器,优化数据获取和存储逻辑
* 重构代码,准备将聊天请求逻辑移入MarshoHandler
* 记录点(
* unfinished
* 🎨 重写基本完毕
* 移除未使用import,添加漏掉的换行
19 lines
625 B
Python
19 lines
625 B
Python
# Marsho 的类实例以及全局变量
|
|
from nonebot import get_driver
|
|
from openai import AsyncOpenAI
|
|
|
|
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))
|
|
client = AsyncOpenAI(base_url=endpoint, api_key=token)
|
|
target_list: list[list] = [] # 记录需保存历史上下文的列表
|