Remove old files

This commit is contained in:
2026-02-14 22:29:44 +00:00
parent 2cc9a73b82
commit fbd010d29d
2 changed files with 0 additions and 143 deletions

View File

@@ -1,80 +0,0 @@
from core.util import logs
from django.core.management.base import BaseCommand
from slixmpp.componentxmpp import ComponentXMPP
from django.conf import settings
from core.models import User, Person, PersonIdentifier, ChatSession
from redis import asyncio as aioredis
from asgiref.sync import sync_to_async
from django.utils.timezone import now
import asyncio
import msgpack
from core.lib import deferred
from core.clients import signalapi
from slixmpp.xmlstream import register_stanza_plugin
from slixmpp.plugins.xep_0085.stanza import Active, Composing, Paused, Inactive, Gone
from slixmpp.stanza import Message
from slixmpp.xmlstream.stanzabase import ElementBase, ET
import aiohttp
from core.messaging import history
log = logs.get_logger("component")
redis = aioredis.from_url("unix://var/run/gia-redis.sock", db=10)
class Attachment(ElementBase):
name = "attachment"
namespace = "urn:xmpp:attachments"
plugin_attrib = "attachment"
interfaces = {"url", "filename", "content_type"}
async def stream(**kwargs):
pubsub = redis.pubsub()
await pubsub.subscribe("component")
while True:
message = await pubsub.get_message(ignore_subscribe_messages=True)
if message is not None:
try:
data = message["data"]
unpacked = msgpack.unpackb(data, raw=False)
log.info(f"Unpacked: {unpacked}")
except TypeError:
continue
if "type" in unpacked.keys():
if unpacked["type"] == "def":
await deferred.process_deferred(
unpacked,
**kwargs
)
await asyncio.sleep(0.01)
class Command(BaseCommand):
def handle(self, *args, **options):
xmpp = EchoComponent(
jid=settings.XMPP_JID,
secret=settings.XMPP_SECRET,
server=settings.XMPP_ADDRESS,
port=settings.XMPP_PORT,
)
xmpp.register_plugin('xep_0030') # Service Discovery
xmpp.register_plugin('xep_0004') # Data Forms
xmpp.register_plugin('xep_0060') # PubSub
xmpp.register_plugin('xep_0199') # XMPP Ping
xmpp.register_plugin("xep_0085") # Chat State Notifications
xmpp.register_plugin('xep_0363') # HTTP File Upload
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.create_task(stream(xmpp=xmpp))
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
xmpp.process()
try:
while True:
pass # Keep the component running
except (KeyboardInterrupt, SystemExit):
log.info("XMPP Component terminating")

View File

@@ -1,63 +0,0 @@
import msgpack
from django.core.management.base import BaseCommand
from django.conf import settings
from signalbot import SignalBot, Command, Context
from asgiref.sync import sync_to_async
from django.urls import reverse
import json
import asyncio
from core.util import logs
from core.lib.prompts.functions import truncate_and_summarize, messages_to_string, delete_messages
from core.lib import deferred
from core.messaging import replies, ai, natural, history, utils
from core.models import Chat, Manipulation, PersonIdentifier, ChatSession, Message, QueuedMessage
import aiohttp
from django.utils import timezone
from django.conf import settings
from core.clients.signal import NewSignalBot
from redis import asyncio as aioredis
SIGNAL_URL = "signal:8080"
log = logs.get_logger("processing")
redis = aioredis.from_url("unix://var/run/gia-redis.sock", db=10)
async def stream():
pubsub = redis.pubsub()
await pubsub.subscribe("processing")
while True:
message = await pubsub.get_message(ignore_subscribe_messages=True)
if message is not None:
try:
data = message["data"]
unpacked = msgpack.unpackb(data, raw=False)
except TypeError:
continue
if "type" in unpacked.keys():
if unpacked["type"] == "def":
await deferred.process_deferred(unpacked)
await asyncio.sleep(0.01)
class Command(BaseCommand):
def handle(self, *args, **options):
bot = NewSignalBot({
"signal_service": SIGNAL_URL,
"phone_number": "+447490296227",
})
bot.register(HandleMessage())
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
bot._event_loop = loop
loop.create_task(stream())
bot.start()
try:
loop.run_forever()
except (KeyboardInterrupt, SystemExit):
log.info("Process terminating")
finally:
loop.close()