Kaynağa Gözat

fix: no summary config bug

zhayujie 2 yıl önce
ebeveyn
işleme
a1aa925019

+ 1 - 1
plugins/linkai/README.md

@@ -93,7 +93,7 @@
 
 #### 配置
 
-该功能依赖 LinkAI的知识库及对话功能,需要在项目根目录的config.json中设置 `linkai_api_key`, 同时根据上述插件配置说明,添加 `summary` 部分的配置,设置 `enabled` 为 true。
+该功能依赖 LinkAI的知识库及对话功能,需要在项目根目录的config.json中设置 `linkai_api_key`, 同时根据上述插件配置说明,在插件config.json添加 `summary` 部分的配置,设置 `enabled` 为 true。
 
 如果不想创建 `plugins/linkai/config.json` 配置,可以直接通过 `$linkai sum open` 指令开启该功能。
 

+ 5 - 2
plugins/linkai/linkai.py

@@ -171,8 +171,11 @@ class LinkAI(Plugin):
             if cmd[2] == "close":
                 tips_text = "关闭"
                 is_open = False
-            self.sum_config["enabled"] = is_open
-            _set_reply_text(f"文章总结功能{tips_text}", e_context, level=ReplyType.INFO)
+            if not self.sum_config:
+                _set_reply_text(f"插件未启用summary功能,请参考以下链添加插件配置\n\nhttps://github.com/zhayujie/chatgpt-on-wechat/blob/master/plugins/linkai/README.md", e_context, level=ReplyType.INFO)
+            else:
+                self.sum_config["enabled"] = is_open
+                _set_reply_text(f"文章总结功能{tips_text}", e_context, level=ReplyType.INFO)
         else:
             _set_reply_text(f"指令错误,请输入{_get_trigger_prefix()}linkai help 获取帮助", e_context,
                             level=ReplyType.INFO)

+ 1 - 1
plugins/linkai/summary.py

@@ -85,5 +85,5 @@ class LinkSummary:
         for support_url in support_list:
             if url.strip().startswith(support_url):
                 return True
-        logger.warn("[LinkSum] unsupported url")
+        logger.debug("[LinkSum] unsupported url, no need to process")
         return False