From 4c9b180431f81e42c1c3c5c98a4263edaa6025a9 Mon Sep 17 00:00:00 2001 From: Andrew Sliva Date: Mon, 2 Mar 2026 12:08:47 -0700 Subject: [PATCH] fix: improve reaction handling logic in Discord bot --- systems/docgpt/src/app/discord.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/systems/docgpt/src/app/discord.py b/systems/docgpt/src/app/discord.py index 21d21db..202a687 100644 --- a/systems/docgpt/src/app/discord.py +++ b/systems/docgpt/src/app/discord.py @@ -147,8 +147,20 @@ async def on_message( add_start_index=True, ).split_text(result.answer) + first_reply_message: discord.Message | None = None for reply in response_chunks: - await user_message.reply(reply) + sent = await user_message.reply(reply) + if first_reply_message is None: + first_reply_message = sent + + # Add feedback reactions to the assistant's first reply (the answer), + # not to the original user question message. + if first_reply_message is not None: + try: + await first_reply_message.add_reaction("👍") + await first_reply_message.add_reaction("👎") + except Exception: + log.exception("Failed to add feedback reactions to assistant reply") if channel.name.lower() == NEW_THREAD_NAME.lower(): title_result = assistant.prompt(