mirror of
https://github.com/LiteyukiStudio/marshoai-melo.git
synced 2024-11-27 05:05:04 +08:00
v0.3.2,实现nickname
This commit is contained in:
parent
b09671093d
commit
0d11be7ade
@ -45,6 +45,20 @@ async def reset(event: Union[GroupMessageEvent, PrivateMessageEvent]):
|
||||
context.reset(get_target_id(event), event.is_private)
|
||||
await send_text("上下文已重置")
|
||||
|
||||
@on_start_match("nickname")
|
||||
async def nickname(event: MessageEvent):
|
||||
nicknames = await get_nicknames()
|
||||
user_id = str(event.sender.user_id)
|
||||
name = event.text.lstrip("nickname ")
|
||||
if not name:
|
||||
await send_text("你的昵称为:"+str(nicknames[user_id]))
|
||||
return
|
||||
if name == "reset":
|
||||
await set_nickname(user_id, "")
|
||||
await send_text("已重置昵称")
|
||||
else:
|
||||
await set_nickname(user_id, name)
|
||||
await send_text("已设置昵称为:"+name)
|
||||
|
||||
@on_start_match("marsho")
|
||||
async def marsho(event: Union[GroupMessageEvent, PrivateMessageEvent]):
|
||||
@ -60,8 +74,15 @@ async def marsho_main(event: Union[GroupMessageEvent, PrivateMessageEvent], is_g
|
||||
try:
|
||||
is_support_image_model = model_name.lower() in SUPPORT_IMAGE_MODELS
|
||||
usermsg = [] if is_support_image_model else ""
|
||||
user_id = event.sender.user_id
|
||||
user_id = str(event.sender.user_id)
|
||||
target_id = get_target_id(event)
|
||||
nicknames = await get_nicknames()
|
||||
nickname = nicknames.get(user_id, "")
|
||||
if nickname != "":
|
||||
nickname_prompt = f"\n*此消息的说话者:{nickname}*"
|
||||
else:
|
||||
nickname_prompt = ""
|
||||
await send_text("*你未设置自己的昵称。推荐使用'nickname [昵称]'命令设置昵称来获得个性化(可能)回答。")
|
||||
nickname_prompt = ""
|
||||
marsho_string_removed = False
|
||||
for i in event.get_segments("image"):
|
||||
@ -126,4 +147,4 @@ async def poke(event: PokeNotifyEvent, adapter: Adapter): # 尚未实现私聊
|
||||
|
||||
class MarshoAI(Plugin):
|
||||
version = VERSION
|
||||
flows = [changemodel,marsho,reset,poke,contexts,praises]
|
||||
flows = [changemodel,marsho,reset,poke,contexts,praises,nickname]
|
||||
|
@ -1,16 +1,15 @@
|
||||
__version__ = "0.3.1.1"
|
||||
__version__ = "0.3.2"
|
||||
VERSION = __version__
|
||||
PLUGIN_NAME = "marshoai"
|
||||
USAGE: str = f"""MarshoAI-Melobot Beta v{__version__} by Asankilp
|
||||
用法:
|
||||
marsho <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。
|
||||
nickname [昵称] : 为自己设定昵称,设置昵称后,Marsho 会根据你的昵称进行回答。使用'nickname reset'命令可清除自己设定的昵称。
|
||||
reset : 重置当前会话的上下文。
|
||||
超级用户命令(均需要加上命令前缀使用):
|
||||
/changemodel <模型名> : 切换全局 AI 模型。
|
||||
/contexts : 返回当前会话的上下文列表。 ※当上下文包含图片时,不要使用此命令。
|
||||
/praises : 返回夸赞名单的提示词。
|
||||
|
||||
|
||||
※本AI的回答"按原样"提供,不提供任何担保。AI也会犯错,请仔细甄别回答的准确性。"""
|
||||
|
||||
SUPPORT_IMAGE_MODELS: list = ["gpt-4o","gpt-4o-mini","llama-3.2-90b-vision-instruct","llama-3.2-11b-vision-instruct"]
|
||||
|
Loading…
Reference in New Issue
Block a user