Format Python code with psf/black push

github-actions 1 year ago
parent d923e02700
commit 0f2d6de54e

@ -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(

@ -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."
)

@ -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

@ -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(

Loading…
Cancel
Save