|
|
@ -149,7 +149,8 @@ class Index_handler:
|
|
|
|
def index_youtube_transcript(self, link, embed_model):
|
|
|
|
def index_youtube_transcript(self, link, embed_model):
|
|
|
|
documents = YoutubeTranscriptReader().load_data(ytlinks=[link])
|
|
|
|
documents = YoutubeTranscriptReader().load_data(ytlinks=[link])
|
|
|
|
index = GPTSimpleVectorIndex(
|
|
|
|
index = GPTSimpleVectorIndex(
|
|
|
|
documents, embed_model=embed_model,
|
|
|
|
documents,
|
|
|
|
|
|
|
|
embed_model=embed_model,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return index
|
|
|
|
return index
|
|
|
|
|
|
|
|
|
|
|
@ -162,7 +163,8 @@ class Index_handler:
|
|
|
|
|
|
|
|
|
|
|
|
def index_discord(self, document, embed_model) -> GPTSimpleVectorIndex:
|
|
|
|
def index_discord(self, document, embed_model) -> GPTSimpleVectorIndex:
|
|
|
|
index = GPTSimpleVectorIndex(
|
|
|
|
index = GPTSimpleVectorIndex(
|
|
|
|
document, embed_model=embed_model,
|
|
|
|
document,
|
|
|
|
|
|
|
|
embed_model=embed_model,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return index
|
|
|
|
return index
|
|
|
|
|
|
|
|
|
|
|
@ -221,6 +223,7 @@ class Index_handler:
|
|
|
|
)
|
|
|
|
)
|
|
|
|
await self.usage_service.update_usage(embedding_model.last_token_usage, embeddings=True)
|
|
|
|
await self.usage_service.update_usage(embedding_model.last_token_usage, embeddings=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_name = file.filename
|
|
|
|
file_name = file.filename
|
|
|
|
self.index_storage[ctx.user.id].add_index(index, ctx.user.id, file_name)
|
|
|
|
self.index_storage[ctx.user.id].add_index(index, ctx.user.id, file_name)
|
|
|
|
await ctx.respond("Index added to your indexes.")
|
|
|
|
await ctx.respond("Index added to your indexes.")
|
|
|
|