浏览代码

fix: do not draw when text_to_image is empty

zhayujie 2 年之前
父节点
当前提交
be0bb591e7
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      bot/linkai/link_ai_bot.py

+ 3 - 0
bot/linkai/link_ai_bot.py

@@ -32,6 +32,9 @@ class LinkAIBot(Bot):
         if context.type == ContextType.TEXT:
             return self._chat(query, context)
         elif context.type == ContextType.IMAGE_CREATE:
+            if not conf().get("text_to_image"):
+                logger.warn("[LinkAI] text_to_image is not enabled, ignore the IMAGE_CREATE request")
+                return Reply(ReplyType.TEXT, "")
             ok, res = self.create_img(query, 0)
             if ok:
                 reply = Reply(ReplyType.IMAGE_URL, res)