diff --git a/plugins/role/role.py b/plugins/role/role.py index 7b6cd74..fd29fa3 100644 --- a/plugins/role/role.py +++ b/plugins/role/role.py @@ -52,7 +52,7 @@ class Role(Plugin): logger.warn("[Role] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/role .") raise e - def get_role(self, name, find_closest=True): + def get_role(self, name, find_closest=True, min_sim = 0.35): name = name.lower() found_role = None if name in self.roles: @@ -62,7 +62,7 @@ class Role(Plugin): def str_simularity(a, b): return difflib.SequenceMatcher(None, a, b).ratio() - max_sim = 0.0 + max_sim = min_sim max_role = None for role in self.roles: sim = str_simularity(name, role)