修复了at时输入命令会导致聊天也触发的bug

This commit is contained in:
Rikka-desu 2024-11-24 15:59:06 +08:00
parent 398ffbee70
commit 62f49eb381
2 changed files with 17 additions and 12 deletions

View File

@ -142,7 +142,7 @@ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
| --------------------- | ---------- | ----------- | ----------------- |
| MARSHOAI_DEFAULT_NAME | `str` | `marsho` | 调用 Marsho 默认的命令前缀 |
| MARSHOAI_ALIASES | `set[str]` | `set{"小棉"}` | 调用 Marsho 的命令别名 |
| MARSHOAI_AT | `bool` | `False` | 决定是否使用at触发
| MARSHOAI_AT | `bool` | `false` | 决定是否使用at触发
#### AI 调用

View File

@ -37,31 +37,36 @@ async def at_enable():
driver = get_driver()
changemodel_cmd = on_command("changemodel", permission=SUPERUSER)
resetmem_cmd = on_command("reset")
changemodel_cmd = on_command("changemodel", permission=SUPERUSER, priority=10, block=True)
resetmem_cmd = on_command("reset", priority=10, block=True)
# setprompt_cmd = on_command("prompt",permission=SUPERUSER)
praises_cmd = on_command("praises", permission=SUPERUSER)
add_usermsg_cmd = on_command("usermsg", permission=SUPERUSER)
add_assistantmsg_cmd = on_command("assistantmsg", permission=SUPERUSER)
contexts_cmd = on_command("contexts", permission=SUPERUSER)
save_context_cmd = on_command("savecontext", permission=SUPERUSER)
load_context_cmd = on_command("loadcontext", permission=SUPERUSER)
praises_cmd = on_command("praises", permission=SUPERUSER, priority=10, block=True)
add_usermsg_cmd = on_command("usermsg", permission=SUPERUSER, priority=10, block=True)
add_assistantmsg_cmd = on_command("assistantmsg", permission=SUPERUSER, priority=10, block=True)
contexts_cmd = on_command("contexts", permission=SUPERUSER, priority=10, block=True)
save_context_cmd = on_command("savecontext", permission=SUPERUSER, priority=10, block=True)
load_context_cmd = on_command("loadcontext", permission=SUPERUSER, priority=10, block=True)
marsho_cmd = on_alconna(
Alconna(
config.marshoai_default_name,
Args["text?", AllParam],
),
aliases=config.marshoai_aliases,
priority=10,
block=True
)
marsho_at = on_message(rule=to_me()&at_enable)
marsho_at = on_message(rule=to_me()&at_enable, priority=11)
nickname_cmd = on_alconna(
Alconna(
"nickname",
Args["name?", str],
)
),
priority = 10,
block = True
)
refresh_data_cmd = on_command("refresh_data", permission=SUPERUSER)
refresh_data_cmd = on_command("refresh_data", permission=SUPERUSER, priority=10, block=True)
command_start = driver.config.command_start
model_name = config.marshoai_default_model
context = MarshoContext()
tools = MarshoTools()