添加昵称长度限制,更新配置和示例文件以支持该功能

This commit is contained in:
Asankilp 2024-12-29 23:13:54 +08:00
parent c8dd126042
commit b417a5c8d0
3 changed files with 7 additions and 0 deletions

View File

@ -222,6 +222,10 @@ async def nickname(event: Event, name=None):
await set_nickname(user_id, "")
await nickname_cmd.finish("已重置昵称")
else:
if len(name) > config.marshoai_nickname_limit:
await nickname_cmd.finish(
"昵称超出长度限制:" + str(config.marshoai_nickname_limit)
)
await set_nickname(user_id, name)
await nickname_cmd.finish("已设置昵称为:" + name)

View File

@ -46,6 +46,7 @@ class ConfigModel(BaseModel):
marshoai_temperature: float | None = None
marshoai_max_tokens: int | None = None
marshoai_top_p: float | None = None
marshoai_nickname_limit: int = 16
marshoai_additional_image_models: list = []
marshoai_tencent_secretid: str | None = None
marshoai_tencent_secretkey: str | None = None

View File

@ -42,6 +42,8 @@ marshoai_enable_plugins: true # 是否启用插件功能。
marshoai_load_builtin_tools: true # 是否加载内置工具。
marshoai_nickname_limit: 16 # 昵称长度限制。
marshoai_toolset_dir: [] # 工具集路径。
marshoai_disabled_toolkits: [] # 已禁用的工具包列表。