diff --git a/astrbot/core/star/star_manager.py b/astrbot/core/star/star_manager.py index b62854c7d..45f107656 100644 --- a/astrbot/core/star/star_manager.py +++ b/astrbot/core/star/star_manager.py @@ -317,8 +317,6 @@ class PluginManager: async def turn_on_plugin(self, plugin_name: str): plugin = self.context.get_registered_star(plugin_name) - if not plugin: - raise Exception("插件已经启用,无需重新启用。") inactivated_plugins: list = sp.get("inactivated_plugins", []) inactivated_llm_tools: list = sp.get("inactivated_llm_tools", []) if plugin.module_path in inactivated_plugins: diff --git a/packages/web_searcher/main.py b/packages/web_searcher/main.py index 31a285394..468fa4337 100644 --- a/packages/web_searcher/main.py +++ b/packages/web_searcher/main.py @@ -22,6 +22,18 @@ class Main(star.Star): self.sogo_search = Sogo() self.google = Google() + self.enable_jinaai = self.context.get_config()['provider_settings']['web_search_jinaai'] + self.jinaai_api_key = self.context.get_config()['provider_settings']['web_search_jinaai_api_key'] + + async def initialize(self): + websearch = self.context.get_config()['provider_settings']['web_search'] + if websearch: + self.context.activate_llm_tool("web_search") + self.context.activate_llm_tool("fetch_url") + else: + self.context.deactivate_llm_tool("web_search") + self.context.deactivate_llm_tool("fetch_url") + async def _tidy_text(self, text: str) -> str: '''清理文本,去除空格、换行符等''' return text.strip().replace("\n", " ").replace("\r", " ").replace(" ", " ")