fix: 紧急为check功能加入开关
This commit is contained in:
@@ -21,6 +21,7 @@ ban_words = [
|
||||
check_interval = 120 # 检查表情包的时间间隔
|
||||
register_interval = 10 # 注册表情包的时间间隔
|
||||
auto_save = true # 自动偷表情包
|
||||
enable_check = false # 是否启用表情包过滤
|
||||
check_prompt = "不要包含违反公序良俗的内容" # 表情包过滤要求
|
||||
|
||||
[cq_code]
|
||||
|
||||
@@ -31,6 +31,7 @@ class BotConfig:
|
||||
EMOJI_CHECK_INTERVAL: int = 120 # 表情包检查间隔(分钟)
|
||||
EMOJI_REGISTER_INTERVAL: int = 10 # 表情包注册间隔(分钟)
|
||||
EMOJI_SAVE: bool = True # 偷表情包
|
||||
EMOJI_CHECK: bool = False #是否开启过滤
|
||||
EMOJI_CHECK_PROMPT: str = "不要包含违反公序良俗的内容" # 表情包过滤要求
|
||||
|
||||
ban_words = set()
|
||||
@@ -100,6 +101,7 @@ class BotConfig:
|
||||
config.EMOJI_REGISTER_INTERVAL = emoji_config.get("register_interval", config.EMOJI_REGISTER_INTERVAL)
|
||||
config.EMOJI_CHECK_PROMPT = emoji_config.get('check_prompt',config.EMOJI_CHECK_PROMPT)
|
||||
config.EMOJI_SAVE = emoji_config.get('auto_save',config.EMOJI_SAVE)
|
||||
config.EMOJI_CHECK = emoji_config.get('enable_check',config.EMOJI_CHECK)
|
||||
|
||||
if "cq_code" in toml_dict:
|
||||
cq_code_config = toml_dict["cq_code"]
|
||||
|
||||
@@ -291,13 +291,14 @@ class EmojiManager:
|
||||
|
||||
# 获取表情包的描述
|
||||
discription = await self._get_emoji_discription(image_base64)
|
||||
check = await self._check_emoji(image_base64)
|
||||
if '是' not in check:
|
||||
os.remove(image_path)
|
||||
logger.info(f"描述: {discription}")
|
||||
logger.info(f"其不满足过滤规则,被剔除 {check}")
|
||||
continue
|
||||
logger.info(f"check通过 {check}")
|
||||
if global_config.EMOJI_CHECK:
|
||||
check = await self._check_emoji(image_base64)
|
||||
if '是' not in check:
|
||||
os.remove(image_path)
|
||||
logger.info(f"描述: {discription}")
|
||||
logger.info(f"其不满足过滤规则,被剔除 {check}")
|
||||
continue
|
||||
logger.info(f"check通过 {check}")
|
||||
embedding = get_embedding(discription)
|
||||
if discription is not None:
|
||||
# 准备数据库记录
|
||||
|
||||
Reference in New Issue
Block a user