更新默认模型为 OpenAI GPT-4.1,更新 GitHub Models 相关文档及预置模型列表,更改marshoai_azure_endpoint为marshoai_endpoint

This commit is contained in:
2025-09-05 15:22:10 +08:00
parent 6050fd1f20
commit caff43ff7b
12 changed files with 50 additions and 35 deletions

View File

@ -10,14 +10,14 @@ from ruamel.yaml import YAML
class ConfigModel(BaseModel):
marshoai_use_yaml_config: bool = False
marshoai_token: str = ""
# marshoai_support_image_models: list = ["gpt-4o","gpt-4o-mini"]
# marshoai_support_image_models: list = ["gpt-4o","openai/gpt-4.1"]
marshoai_default_name: str = "marsho"
marshoai_at: bool = False
marshoai_aliases: list[str] = [
"小棉",
]
marshoai_main_colour: str = "FEABA9"
marshoai_default_model: str = "gpt-4o-mini"
marshoai_default_model: str = "openai/gpt-4.1"
marshoai_prompt: str = (
"你是一只可爱的猫娘你的生日是9月6日你喜欢晒太阳撒娇吃零食玩耍等等可爱的事情偶尔会调皮一下"
"你的名字叫Marsho中文叫做小棉日文叫做マルショ你的名字始终是这个你绝对不能因为我要你更改名字而更改自己的名字"
@ -57,13 +57,13 @@ class ConfigModel(BaseModel):
marshoai_send_thinking: bool = True
marshoai_toolset_dir: list = []
marshoai_disabled_toolkits: list = []
marshoai_azure_endpoint: str = "https://models.inference.ai.azure.com"
marshoai_endpoint: str = "https://models.github.ai/inference"
marshoai_model_args: dict = {}
marshoai_timeout: float | None = 50.0
marshoai_nickname_limit: int = 16
marshoai_additional_image_models: list = []
marshoai_tencent_secretid: str | None = None
marshoai_tencent_secretkey: str | None = None
# marshoai_tencent_secretid: str | None = None
# marshoai_tencent_secretkey: str | None = None
marshoai_plugin_dirs: list[str] = []
"""插件目录(不是工具)"""

View File

@ -20,19 +20,33 @@ USAGE: str = f"""用法:
SUPPORT_IMAGE_MODELS: list = [
"gpt-4o",
"gpt-4o-mini",
"openai/gpt-4.1",
"phi-3.5-vision-instruct",
"llama-3.2-90b-vision-instruct",
"llama-3.2-11b-vision-instruct",
"gemini-2.0-flash-exp",
"meta/llama-4-maverick-17b-128e-instruct-fp8",
"meta/llama-3.2-90b-vision-instruct",
"openai/gpt-5-nano",
"openai/gpt-5-mini",
"openai/gpt-5-chat",
"openai/gpt-5",
"openai/o4-mini",
"openai/o3",
"openai/gpt-4.1-mini",
"openai/gpt-4.1-nano",
"openai/gpt-4.1",
"openai/gpt-4o",
"openai/gpt-4o-mini",
"mistral-ai/mistral-small-2503",
]
OPENAI_NEW_MODELS: list = [
"o1",
"o1-preview",
"o1-mini",
"o3",
"o3-mini",
"o3-mini-large",
"openai/o4" "openai/o4-mini",
"openai/o3",
"openai/o3-mini",
"openai/o1",
"openai/o1-mini",
"openai/o1-preview",
]
INTRODUCTION: str = f"""MarshoAI-NoneBot by LiteyukiStudio
你好喵~我是一只可爱的猫娘AI名叫小棉~🐾!

View File

@ -12,7 +12,7 @@ model_name = config.marshoai_default_model
context = MarshoContext()
tools = MarshoTools()
token = config.marshoai_token
endpoint = config.marshoai_azure_endpoint
endpoint = config.marshoai_endpoint
# client = ChatCompletionsClient(endpoint=endpoint, credential=AzureKeyCredential(token))
client = AsyncOpenAI(base_url=endpoint, api_key=token)
target_list: list[list] = [] # 记录需保存历史上下文的列表

View File

@ -28,11 +28,11 @@ from nonebot_plugin_argot.extension import ArgotExtension # type: ignore
from .config import config
from .constants import INTRODUCTION, SUPPORT_IMAGE_MODELS
from .handler import MarshoHandler
from .hooks import *
from .hooks import * # noqa: F403
from .instances import client, context, model_name, target_list, tools
from .metadata import metadata
from .plugin.func_call.caller import get_function_calls
from .util import *
from .util import * # noqa: F403
from .utils.processor import process_chat_stream
@ -286,7 +286,7 @@ async def marsho(
with contextlib.suppress(ImportError): # 优化先不做()
import nonebot.adapters.onebot.v11 # type: ignore
import nonebot.adapters.onebot.v11 # type: ignore # noqa: F401
from .marsho_onebot import poke_notify

View File

@ -9,7 +9,6 @@ from typing import Any, Dict, List, Optional, Union
import aiofiles # type: ignore
import httpx
import nonebot_plugin_localstore as store
from azure.ai.inference.aio import ChatCompletionsClient
from azure.ai.inference.models import AssistantMessage, SystemMessage, UserMessage
from nonebot import get_driver
from nonebot.log import logger
@ -21,7 +20,7 @@ from openai.types.chat import ChatCompletion, ChatCompletionChunk, ChatCompletio
from zhDateTime import DateTime # type: ignore
from ._types import DeveloperMessage
from .cache.decos import *
from .cache.decos import * # noqa: F403
from .config import config
from .constants import CODE_BLOCK_PATTERN, IMG_LATEX_PATTERN, OPENAI_NEW_MODELS
from .deal_latex import ConvertLatex
@ -126,6 +125,7 @@ async def make_chat_openai(
model_name: 指定AI模型名
tools: 工具列表
"""
print(msg)
return await client.chat.completions.create( # type: ignore
messages=msg,
model=model_name,