Skip to content

Commit

Permalink
react to message while processing
Browse files Browse the repository at this point in the history
  • Loading branch information
adbenitez committed Sep 4, 2024
1 parent b2f21b2 commit 04574e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deltachat_chatbot/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def on_message(bot: Bot, accid: int, event: NewMsgEvent) -> None:
send_help(bot, accid, msg.chat_id)
return

bot.rpc.send_reaction(accid, msg.id, ["⏳"])
with gpt4all.chat_session(system_prompt=args.system_prompt or None):
bot.logger.debug(f"[chat={msg.chat_id}] Processing message={msg.id}")
load_history(bot, accid, msg.chat_id)
Expand All @@ -131,6 +132,7 @@ def on_message(bot: Bot, accid: int, event: NewMsgEvent) -> None:
took = time.time() - start
bot.logger.debug(f"[chat={msg.chat_id}] Generated reply in {took:.1f} seconds")

bot.rpc.send_reaction(accid, msg.id, [])
bot.rpc.send_msg(accid, msg.chat_id, MsgData(text=text, quoted_message_id=msg.id))


Expand Down

0 comments on commit 04574e2

Please sign in to comment.