diff --git a/docs/en/start/install.md b/docs/en/start/install.md index 8bc4a0b4..99a3c915 100644 --- a/docs/en/start/install.md +++ b/docs/en/start/install.md @@ -122,9 +122,8 @@ Add options in the `.env` file from the diagram below in nonebot2 project. | MARSHOAI_ENFORCE_NICKNAME | `bool` | `true` | Enforce user to set nickname or not | | MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is `*[昵称]揉了揉你的猫耳。` | | MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI standard API | -| MARSHOAI_TEMPERATURE | `float` | `null` | temperature parameter | -| MARSHOAI_TOP_P | `float` | `null` | Nucleus Sampling parameter | -| MARSHOAI_MAX_TOKENS | `int` | `null` | Max token number | +| MARSHOAI_MODEL_ARGS | `dict` | `{}` |model arguments(such as `temperature`, `top_p`, `max_tokens` etc.) | + | MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | External image-support model list, such as `hunyuan-vision` | | MARSHOAI_NICKNAME_LIMIT | `int` | `16` | Limit for nickname length | | MARSHOAI_TIMEOUT | `float` | `50` | AI request timeout (seconds) | diff --git a/docs/zh/start/install.md b/docs/zh/start/install.md index 885af28c..ff5080a3 100644 --- a/docs/zh/start/install.md +++ b/docs/zh/start/install.md @@ -124,9 +124,7 @@ GitHub Models API 的限制较多,不建议使用,建议通过修改`MARSHOA | MARSHOAI_ENFORCE_NICKNAME | `bool` | `true` | 是否强制用户设置昵称 | | MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | 对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为`*[昵称]揉了揉你的猫耳。` | | MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI 标准格式 API 端点 | -| MARSHOAI_TEMPERATURE | `float` | `null` | 推理生成多样性(温度)参数 | -| MARSHOAI_TOP_P | `float` | `null` | 推理核采样参数 | -| MARSHOAI_MAX_TOKENS | `int` | `null` | 最大生成 token 数 | +| MARSHOAI_MODEL_ARGS | `dict` | `{}` | 模型参数(例如`temperature`, `top_p`, `max_tokens`等) | | MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | 额外添加的支持图片的模型列表,例如`hunyuan-vision` | | MARSHOAI_NICKNAME_LIMIT | `int` | `16` | 昵称长度限制 | | MARSHOAI_TIMEOUT | `float` | `50` | AI 请求超时时间(秒) | diff --git a/nonebot_plugin_marshoai/config.py b/nonebot_plugin_marshoai/config.py index b3989255..344120ef 100644 --- a/nonebot_plugin_marshoai/config.py +++ b/nonebot_plugin_marshoai/config.py @@ -55,9 +55,7 @@ class ConfigModel(BaseModel): marshoai_toolset_dir: list = [] marshoai_disabled_toolkits: list = [] marshoai_azure_endpoint: str = "https://models.inference.ai.azure.com" - marshoai_temperature: float | None = None - marshoai_max_tokens: int | None = None - marshoai_top_p: float | None = None + marshoai_model_args: dict = {} marshoai_timeout: float | None = 50.0 marshoai_nickname_limit: int = 16 marshoai_additional_image_models: list = [] diff --git a/nonebot_plugin_marshoai/config_example.yaml b/nonebot_plugin_marshoai/config_example.yaml index baff6bbd..b1c496d2 100644 --- a/nonebot_plugin_marshoai/config_example.yaml +++ b/nonebot_plugin_marshoai/config_example.yaml @@ -61,9 +61,7 @@ marshoai_devmode: false # 是否启用开发者模式。 marshoai_azure_endpoint: "https://models.inference.ai.azure.com" # OpenAI 标准格式 API 的端点。 # 模型参数配置 -marshoai_temperature: null # 调整生成的多样性,未设置时使用默认值。 -marshoai_max_tokens: null # 最大生成的token数,未设置时使用默认值。 -marshoai_top_p: null # 使用的概率采样值,未设置时使用默认值。 +marshoai_model_args: {} # 模型参数配置,默认空。 marshoai_timeout: 50.0 # 请求超时时间。 marshoai_additional_image_models: [] # 额外的图片模型列表,默认空。 diff --git a/nonebot_plugin_marshoai/util.py b/nonebot_plugin_marshoai/util.py index 5380f1a4..066144cf 100755 --- a/nonebot_plugin_marshoai/util.py +++ b/nonebot_plugin_marshoai/util.py @@ -126,9 +126,7 @@ async def make_chat( messages=msg, model=model_name, tools=tools, - temperature=config.marshoai_temperature, - max_tokens=config.marshoai_max_tokens, - top_p=config.marshoai_top_p, + **config.marshoai_model_args, ) @@ -151,10 +149,8 @@ async def make_chat_openai( messages=msg, model=model_name, tools=tools or NOT_GIVEN, - temperature=config.marshoai_temperature or NOT_GIVEN, - max_tokens=config.marshoai_max_tokens or NOT_GIVEN, - top_p=config.marshoai_top_p or NOT_GIVEN, timeout=config.marshoai_timeout, + **config.marshoai_model_args, )