Skip to content

Commit

Permalink
Remove citations from AI context
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Nov 17, 2024
1 parent 3e34fc4 commit c6b27e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ async def hey(self, ctx: commands.Context):
author_display_name_with_id = f"{message.author.display_name} <@{message.author.id}>"
try:
clean_content = await self.message_to_text(ctx, message)
if clean_content is None:
continue
clean_content = clean_content.split('-#')[0].strip() # Remove citations
except IndexError:
break
if clean_content is None:
continue
# Append
prompt_token_count_so_far += len(encoding.encode(clean_content))
history.append(
Expand Down

0 comments on commit c6b27e6

Please sign in to comment.