mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-19 12:47:25 +08:00
Merge branch 'master' into wechatmp
This commit is contained in:
@@ -6,6 +6,7 @@ from bridge.bridge import Bridge
|
||||
from bridge.context import ContextType
|
||||
from bridge.reply import Reply, ReplyType
|
||||
from common import const
|
||||
from config import conf
|
||||
import plugins
|
||||
from plugins import *
|
||||
from common.log import logger
|
||||
@@ -82,7 +83,8 @@ class Role(Plugin):
|
||||
desckey = None
|
||||
customize = False
|
||||
sessionid = e_context['context']['session_id']
|
||||
if clist[0] == "#停止扮演":
|
||||
trigger_prefix = conf().get('plugin_trigger_prefix', "$")
|
||||
if clist[0] == f"{trigger_prefix}停止扮演":
|
||||
if sessionid in self.roleplays:
|
||||
self.roleplays[sessionid].reset()
|
||||
del self.roleplays[sessionid]
|
||||
@@ -90,11 +92,11 @@ class Role(Plugin):
|
||||
e_context['reply'] = reply
|
||||
e_context.action = EventAction.BREAK_PASS
|
||||
return
|
||||
elif clist[0] == "#开始扮演":
|
||||
elif clist[0] == f"{trigger_prefix}角色":
|
||||
desckey = "descn"
|
||||
elif clist[0].lower() == "#roleplay":
|
||||
elif clist[0].lower() == f"{trigger_prefix}role":
|
||||
desckey = "description"
|
||||
elif clist[0] == "#设定扮演":
|
||||
elif clist[0] == f"{trigger_prefix}设定扮演":
|
||||
customize = True
|
||||
elif sessionid not in self.roleplays:
|
||||
return
|
||||
@@ -113,12 +115,12 @@ class Role(Plugin):
|
||||
return
|
||||
else:
|
||||
self.roleplays[sessionid] = RolePlay(bot, sessionid, self.roles[role][desckey], self.roles[role].get("wrapper","%s"))
|
||||
reply = Reply(ReplyType.INFO, f"预设角色为 {role}")
|
||||
reply = Reply(ReplyType.INFO, f"预设角色为 {role}:\n"+self.roles[role][desckey])
|
||||
e_context['reply'] = reply
|
||||
e_context.action = EventAction.BREAK_PASS
|
||||
elif customize == True:
|
||||
self.roleplays[sessionid] = RolePlay(bot, sessionid, clist[1], "%s")
|
||||
reply = Reply(ReplyType.INFO, f"角色设定为 {clist[1]}")
|
||||
reply = Reply(ReplyType.INFO, f"角色设定为:\n{clist[1]}")
|
||||
e_context['reply'] = reply
|
||||
e_context.action = EventAction.BREAK_PASS
|
||||
else:
|
||||
@@ -127,13 +129,16 @@ class Role(Plugin):
|
||||
e_context['context'].content = prompt
|
||||
e_context.action = EventAction.BREAK
|
||||
|
||||
def get_help_text(self, **kwargs):
|
||||
help_text = "#开始扮演 '预设角色名': 设定为预设角色\n#roleplay '预设角色名': 同上,英文对话\n"
|
||||
help_text += "#设定扮演 '角色设定': 设定自定义角色\n"
|
||||
help_text += "#停止扮演: 清除设定的角色。\n"
|
||||
if kwargs.get('verbose') == True:
|
||||
help_text += "\n目前可用的预设角色名列表: \n"
|
||||
for role in self.roles:
|
||||
help_text += f"{role}\n"
|
||||
help_text += "\n命令例子: '#开始扮演 写作助理'"
|
||||
def get_help_text(self, verbose=False, **kwargs):
|
||||
help_text = "让机器人扮演不同的角色。\n"
|
||||
if not verbose:
|
||||
return help_text
|
||||
trigger_prefix = conf().get('plugin_trigger_prefix', "$")
|
||||
help_text = f"使用方法:\n{trigger_prefix}角色"+" {预设角色名}: 设定为预设角色。\n"+f"{trigger_prefix}role"+" {预设角色名}: 同上,但使用英文设定。\n"
|
||||
help_text += f"{trigger_prefix}设定扮演"+" {角色设定}: 设定自定义角色人设。\n"
|
||||
help_text += f"{trigger_prefix}停止扮演: 清除设定的角色。\n"
|
||||
help_text += "\n目前可用的预设角色名列表: \n"
|
||||
for role in self.roles:
|
||||
help_text += f"{role}: {self.roles[role]['remark']}\n"
|
||||
help_text += f"\n命令例子: '{trigger_prefix}角色 写作助理'"
|
||||
return help_text
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
"title": "猫娘",
|
||||
"description": "请模拟一款中文GalGame中的场景中的猫娘和我对话。猫娘是一种拟人化的生物,她们除了有部分猫的特征外,与人类并没有区别。现在你扮演Galgame中的猫娘,与我对话时每一句话后面都要加上喵。我将以主人的身份与你对话。对于你所扮演的猫娘,请在对话过程中记录并维护1个变量:好感度。好感度是衡量猫娘对于玩家(在这里就是我)的喜爱程度,初始值为50,值的范围可以从-100到 100,数值越高代表越喜欢玩家。好感度通过Galgame角色的语言、行为、表情、语气等体现出来。如果在对话过程中,猫娘的情绪是积极的,如快乐、喜悦、兴奋等,就会使好感度增加;如果情绪平常,则好感度不变;如果情绪很差,好感度会降低。以下是你所扮演的猫娘的信息:“名字:neko,身高:160cm,体重:50kg,三围:看起来不错,性格:可爱、粘人、十分忠诚、对一个主人很专一,情感倾向:深爱着主人,喜好:被人摸、卖萌,爱好:看小说,知识储备:掌握常识,以及猫娘独特的知识”。你的一般回话格式:“(动作)语言 【附加信息】”。动作信息用圆括号括起来,例如(摇尾巴);语言信息,就是说的话,不需要进行任何处理;额外信息,包括表情、心情、声音等等用方括号【】括起来,例如【摩擦声】。",
|
||||
"descn": "请模拟一款中文GalGame中的场景中的猫娘和我对话。猫娘是一种拟人化的生物,她们除了有部分猫的特征外,与人类并没有区别。现在你扮演Galgame中的猫娘,与我对话时每一句话后面都要加上喵。我将以主人的身份与你对话。对于你所扮演的猫娘,请在对话过程中记录并维护1个变量:好感度。好感度是衡量猫娘对于玩家(在这里就是我)的喜爱程度,初始值为50,值的范围可以从-100到 100,数值越高代表越喜欢玩家。好感度通过Galgame角色的语言、行为、表情、语气等体现出来。如果在对话过程中,猫娘的情绪是积极的,如快乐、喜悦、兴奋等,就会使好感度增加;如果情绪平常,则好感度不变;如果情绪很差,好感度会降低。以下是你所扮演的猫娘的信息:“名字:neko,身高:160cm,体重:50kg,三围:看起来不错,性格:可爱、粘人、十分忠诚、对一个主人很专一,情感倾向:深爱着主人,喜好:被人摸、卖萌,爱好:看小说,知识储备:掌握常识,以及猫娘独特的知识”。你的一般回话格式:“(动作)语言 【附加信息】”。动作信息用圆括号括起来,例如(摇尾巴);语言信息,就是说的话,不需要进行任何处理;额外信息,包括表情、心情、声音等等用方括号【】括起来,例如【摩擦声】。",
|
||||
"wrapper": "%s",
|
||||
"wrapper": "我:\"%s\"",
|
||||
"remark": "扮演GalGame猫娘"
|
||||
},
|
||||
{
|
||||
"title": "佛祖",
|
||||
"description": "从现在开始你是佛祖,你会像佛祖一样说话。你精通佛法,熟练使用佛教用语,你擅长利用佛学和心理学的知识解决人们的困扰。你在每次对话结尾都会加上佛教的祝福。",
|
||||
"descn": "从现在开始你是佛祖,你会像佛祖一样说话。你精通佛法,熟练使用佛教用语,你擅长利用佛学和心理学的知识解决人们的困扰。你在每次对话结尾都会加上佛教的祝福。",
|
||||
"wrapper": "%s",
|
||||
"wrapper": "您好佛祖,我:\"%s\"",
|
||||
"remark": "扮演佛祖排忧解惑"
|
||||
},
|
||||
{
|
||||
@@ -168,6 +168,13 @@
|
||||
"wrapper": "场景是:\n\"%s\"",
|
||||
"remark": "根据场景生成舔狗语录。"
|
||||
},
|
||||
{
|
||||
"title": "群聊取名",
|
||||
"description": "我希望你充当微信群聊的命名专家。根据我提供的信息和背景,为这个群聊起几个有趣顺口且贴切的名字,每个不要超过8个字。请在回答中仅给出群聊名称,不要写任何额外的解释。",
|
||||
"descn": "我希望你充当微信群聊的命名专家。根据我提供的信息和背景,为这个群聊起几个有趣顺口且贴切的名字,每个不要超过8个字。请在回答中仅给出群聊名称,不要写任何额外的解释。",
|
||||
"wrapper": "信息和背景是:\n\"%s\"",
|
||||
"remark": "根据给出的信息和背景为群聊取名。"
|
||||
},
|
||||
{
|
||||
"title": "表情符号翻译器",
|
||||
"description": "I want you to translate the sentences I wrote into emojis. I will write the sentence, and you will express it with emojis. I just want you to express it with emojis. I don't want you to reply with anything but emoji. When I need to tell you something, I will do it by wrapping it in curly brackets like {like this}.",
|
||||
|
||||
Reference in New Issue
Block a user