Add filter
This commit is contained in:
@@ -170,8 +170,39 @@ class HandleMessage(Command):
|
||||
#recipient_jid = f"{identifier.user.username}@{settings.XMPP_ADDRESS}"
|
||||
user = identifier.user
|
||||
|
||||
log.info(f"Sending {len(xmpp_attachments)} attachments from Signal to XMPP.")
|
||||
await self.ur.xmpp.client.send_from_external(user, identifier, text, is_outgoing_message, attachments=xmpp_attachments)
|
||||
manipulations = Manipulation.objects.filter(
|
||||
group__people=identifier.person,
|
||||
user=identifier.user,
|
||||
#mode="mutate",
|
||||
filter_enabled=True,
|
||||
enabled=True,
|
||||
)
|
||||
# chat_history = await history.get_chat_history(session)
|
||||
# await utils.update_last_interaction(session)
|
||||
if manipulations:
|
||||
manip = manipulations.first()
|
||||
prompt = replies.generate_mutate_reply_prompt(
|
||||
text,
|
||||
None,
|
||||
manip,
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
log.info("Running Signal context prompt")
|
||||
result = await ai.run_prompt(prompt, manip.ai)
|
||||
log.info(f"RESULT {result}")
|
||||
# await history.store_own_message(
|
||||
# session=session,
|
||||
# text=result,
|
||||
# ts=int(now().timestamp() * 1000),
|
||||
# )
|
||||
log.info(f"Sending {len(xmpp_attachments)} attachments from Signal to XMPP.")
|
||||
await self.ur.xmpp.client.send_from_external(user, identifier, result, is_outgoing_message, attachments=xmpp_attachments)
|
||||
|
||||
if not manipulations.exists():
|
||||
log.info(f"Sending {len(xmpp_attachments)} attachments from Signal to XMPP.")
|
||||
await self.ur.xmpp.client.send_from_external(user, identifier, text, is_outgoing_message, attachments=xmpp_attachments)
|
||||
|
||||
####
|
||||
|
||||
@@ -222,7 +253,7 @@ class HandleMessage(Command):
|
||||
reply_to_others,
|
||||
is_outgoing_message,
|
||||
):
|
||||
if manip.mode != "silent":
|
||||
if manip.mode not in ["silent", "mutate"]:
|
||||
await utils.update_last_interaction(chat_session)
|
||||
prompt = replies.generate_reply_prompt(
|
||||
msg,
|
||||
@@ -240,6 +271,7 @@ class HandleMessage(Command):
|
||||
ts=ts + 1,
|
||||
)
|
||||
# await natural.natural_send_message(c, result)
|
||||
await self.ur.xmpp.client.send_from_external(manip.user, person_identifier, result, is_outgoing_message=True)
|
||||
tss = await natural.natural_send_message(
|
||||
result,
|
||||
c.send,
|
||||
|
||||
Reference in New Issue
Block a user