Skip to content

Commit

Permalink
Added message splitter to the chat history viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
LobaDK committed Mar 21, 2024
1 parent ec6e2b5 commit 86ad538
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cogs/Chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,13 @@ async def initiatechatview(self, ctx: commands.Context, shared_chat: bool):
messages.append("Chat history for this server:")
for message in conversation_history:
messages.append(f"{message['role'].title()}: {message['content']}")
await ctx.reply("\n".join(messages), silent=True)
message = "\n".join(messages)
if len(message) > 2000:
message = await self.split_message_by_sentence(message)
for msg in message:
await ctx.reply(msg, silent=True)
else:
await ctx.reply(message, silent=True)
else:
await ctx.reply("No chat history found in this server.", silent=True)

Expand Down

0 comments on commit 86ad538

Please sign in to comment.