fix: websearch 在 cmd_config 中失效的问题
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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(" ", " ")
|
||||
|
||||
Reference in New Issue
Block a user