mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-02-13 04:19:59 +08:00
重构模型参数配置,合并为marshoai_model_args字典 (#11)
This commit is contained in:
parent
6885487709
commit
0c57ace798
@ -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) |
|
||||
|
@ -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 请求超时时间(秒) |
|
||||
|
@ -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 = []
|
||||
|
@ -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: [] # 额外的图片模型列表,默认空。
|
||||
|
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user