def order_trigger(sender): # Check if the last message contains the path to the instruction text file return "instruction & resources saved to" in sender.last_message()["content"] def order_message(recipient, messages, sender, config): # Extract the path to the instruction text file from the last message full_order = recipient.chat_messages_for_summary(sender)[-1]["content"] txt_path = full_order.replace("instruction & resources saved to ", "").strip() with open(txt_path, "r") as f: instruction = f.read() + "\n\nReply TERMINATE at the end of your response." return instruction