From c9602263d4cf1ffe86b24ad813f96084af80dc85 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Thu, 25 Apr 2024 19:21:01 +0100 Subject: [PATCH 1/3] Add docker auto-build --- .gitea/workflows/docker-publish.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitea/workflows/docker-publish.yaml diff --git a/.gitea/workflows/docker-publish.yaml b/.gitea/workflows/docker-publish.yaml new file mode 100644 index 0000000..899d478 --- /dev/null +++ b/.gitea/workflows/docker-publish.yaml @@ -0,0 +1,19 @@ +name: Build and Publish Jimmy.2 +run-name: Build and Publish Jimmy.2 +on: [push] + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Build Docker image + run: | + docker build -t git.i-am.nexus/nex/college-bot:latest . + - name: Log into container registry + run: | + docker login -u ${{ secrets.CR_USERNAME }} -p ${{ secrets.CR_PASSWORD }} git.i-am.nexus + - name: Push to container registry + run: | + docker push git.i-am.nexus/nex/college-bot:latest \ No newline at end of file From 415a9ed21b27baafb074ba1c82a95bc285d698a5 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Thu, 25 Apr 2024 19:33:34 +0100 Subject: [PATCH 2/3] Update ollama command --- docker-compose.yml | 4 +--- src/cogs/ollama.py | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2c2374f..b79adf9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: jimmy: container_name: jimmy-v2 - build: . + image: git.i-am.nexus/nex/college-bot:latest restart: unless-stopped tty: true volumes: @@ -9,8 +9,6 @@ services: - ./jimmy.log:/app/jimmy.log - /dev/dri:/dev/dri - jimmy-data:/app/data - ports: - - 11444:8080 extra_hosts: - host.docker.internal:host-gateway ollama: diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index dcab45b..d45eceb 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -507,6 +507,8 @@ class Ollama(commands.Cog): discord.Option(discord.Attachment, "An image to feed into ollama. Only works with llava.", default=None), ], ): + if not SERVER_KEYS: + return await ctx.respond("No servers available. Please try again later.") system_query = None if context is not None: if not self.history.get_thread(context): @@ -834,7 +836,8 @@ class Ollama(commands.Cog): ], ): """Shows the history for a thread.""" - # await ctx.defer(ephemeral=True) + if not SERVER_KEYS: + return await ctx.respond("No servers available. Please try again later.") paginator = commands.Paginator("", "", 4000, "\n\n") thread = self.history.load_thread(thread_id) @@ -859,6 +862,8 @@ class Ollama(commands.Cog): @commands.message_command(name="Ask AI") async def ask_ai(self, ctx: discord.ApplicationContext, message: discord.Message): + if not SERVER_KEYS: + return await ctx.respond("No servers available. Please try again later.") thread = self.history.create_thread(message.author) content = message.clean_content if not content: From ba57e6ed43a6c74cdc6ac91793dcd47bf2d21125 Mon Sep 17 00:00:00 2001 From: nex Date: Thu, 25 Apr 2024 23:53:13 +0100 Subject: [PATCH 3/3] Tweak quote regex --- src/cogs/quote_quota.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cogs/quote_quota.py b/src/cogs/quote_quota.py index 4561b8c..9f59eaf 100644 --- a/src/cogs/quote_quota.py +++ b/src/cogs/quote_quota.py @@ -126,9 +126,9 @@ class QuoteQuota(commands.Cog): filtered_messages += 1 continue if message.attachments: - regex = r".*\s*-\s*@?([\w\s]+)" + regex = r".*\s*-\s*([\w]+)" else: - regex = r".+\s+-\s*@?([\w\s]+)" + regex = r".+\s+-\s*([\w]+)" if not (m := re.match(regex, str(message.clean_content))): filtered_messages += 1