diff --git a/cogs/commands.py b/cogs/commands.py index b24d3c5..f3a6978 100644 --- a/cogs/commands.py +++ b/cogs/commands.py @@ -550,10 +550,16 @@ class Commands(discord.Cog, name="Commands"): autocomplete=File_autocompleter.get_user_search_indexes, ) async def load_index( - self, ctx: discord.ApplicationContext, user_index: str, server_index: str, search_index: str + self, + ctx: discord.ApplicationContext, + user_index: str, + server_index: str, + search_index: str, ): await ctx.defer() - await self.index_cog.load_index_command(ctx, user_index, server_index, search_index) + await self.index_cog.load_index_command( + ctx, user_index, server_index, search_index + ) @add_to_group("index") @discord.slash_command( diff --git a/cogs/index_service_cog.py b/cogs/index_service_cog.py index f025f62..004343c 100644 --- a/cogs/index_service_cog.py +++ b/cogs/index_service_cog.py @@ -101,7 +101,14 @@ class IndexService(discord.Cog, name="IndexService"): await ctx.respond("Please provide a user or server or search index") return - if user_index and server_index or user_index and search_index or server_index and search_index: + if ( + user_index + and server_index + or user_index + and search_index + or server_index + and search_index + ): await ctx.respond( "Please only try to load one type of index. Either a user index, a server index or a search index." ) diff --git a/cogs/search_service_cog.py b/cogs/search_service_cog.py index 320469e..91ea63a 100644 --- a/cogs/search_service_cog.py +++ b/cogs/search_service_cog.py @@ -108,7 +108,6 @@ class SearchService(discord.Cog, name="SearchService"): await ctx.respond("The search service is not enabled.") return - try: response, refined_text = await self.model.search( ctx, query, user_api_key, search_scope, nodes, deep diff --git a/models/search_model.py b/models/search_model.py index 80df00b..f506903 100644 --- a/models/search_model.py +++ b/models/search_model.py @@ -50,7 +50,9 @@ class Search: def add_search_index(self, index, user_id, query): # Create a folder called "indexes/{USER_ID}" if it doesn't exist already - Path(f"{app_root_path()}/indexes/{user_id}_search").mkdir(parents=True, exist_ok=True) + Path(f"{app_root_path()}/indexes/{user_id}_search").mkdir( + parents=True, exist_ok=True + ) # Save the index to file under the user id file = f"{query[:20]}_{date.today().month}_{date.today().day}" @@ -308,7 +310,13 @@ class Search: ) # save the index to disk if not a redo if not redo: - self.add_search_index(index, ctx.user.id if isinstance(ctx, discord.ApplicationContext) else ctx.author.id, query) + self.add_search_index( + index, + ctx.user.id + if isinstance(ctx, discord.ApplicationContext) + else ctx.author.id, + query, + ) else: print("Doing a deep search") llm_predictor_deep = LLMPredictor(