Skip to content

Commit

Permalink
Merge pull request #1037 from mraniki/dev
Browse files Browse the repository at this point in the history
LlmPlugin Update
  • Loading branch information
github-actions[bot] authored Nov 12, 2023
2 parents c88a7f6 + 0eb33a6 commit 6c70123
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tt/plugins/default_plugins/llm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import os
import asyncio
import threading
from myllm import MyLLM

from tt.config import settings
Expand Down Expand Up @@ -33,16 +33,17 @@ async def send_notification(self, message):
if self.enabled:
await send_notification(message)


async def handle_message(self, msg):
"""Handles incoming messages"""
if not self.should_handle(msg):
return
elif (
if (
self.llm.llm_ai_mode
and (settings.bot_ignore not in msg)
and (not msg.startswith(settings.bot_prefix))
):
asyncio.create_task(self.send_notification(await self.llm.chat(str(msg))))
threading.Thread(target=self.process_chat, args=(msg,)).start()


if msg.startswith(settings.bot_prefix):
Expand All @@ -59,3 +60,7 @@ async def handle_message(self, msg):
if command in command_mapping:
function = command_mapping[command]
await self.send_notification(f"{await function()}")

def process_chat(self, msg):
chat = self.llm.chat(str(msg))
self.send_notification(chat)

0 comments on commit 6c70123

Please sign in to comment.