Skip to content

Commit

Permalink
♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Aug 5, 2023
1 parent ebd3fbf commit 7c8492d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
7 changes: 4 additions & 3 deletions tt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ def loguru_setup():
log_filters = {
"discord": "ERROR",
"telethon": "ERROR",
"web3": "INFO",
"apprise": "INFO",
"urllib3": "INFO",
# "web3": "ERROR",
# "apprise": "ERROR",
# "urllib3": "ERROR",
"asyncz": "ERROR",
}
logging.basicConfig(handlers=[InterceptHandler()], level=0, force=True)
loguru_logger.add(
Expand Down
19 changes: 12 additions & 7 deletions tt/plugins/default_plugins/llm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"""
import os

from myllm import MyLLM
from myllm import MyLLM, version


from tt.config import logger, settings
from tt.config import settings
from tt.plugins.plugin_manager import BasePlugin
from tt.utils import send_notification

Expand All @@ -19,7 +18,7 @@ def __init__(self):
super().__init__()
self.enabled = settings.llm_enabled
if self.enabled:
self.version = "🦾"
self.version = f"MyLLM v{version}"
self.help_message = settings.llm_commands
self.llm= MyLLM()

Expand Down Expand Up @@ -48,6 +47,7 @@ async def handle_message(self, msg):
settings.bot_command_help: self.get_llm_help,
settings.bot_command_info: self.get_llm_info,
settings.bot_command_question: lambda: self.get_llm_run(args),
settings.bot_command_topic: lambda: self.get_llm_chain(args),
}
if command in command_mapping:
function = command_mapping[command]
Expand All @@ -61,13 +61,18 @@ async def get_llm_info(self):
"""info Message"""
return self.version

async def get_llm_run(self,llm_request):
async def get_llm_run(self,prompt):
"""
Gets the llm prompts response
"""

return await self.llm.talk(llm_request)

return await self.llm.talk(prompt)

async def get_llm_chain(self,prompt):
"""
Gets the llm prompts chain response
"""

pass


22 changes: 11 additions & 11 deletions tt/plugins/default_plugins/www_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"""
import os

from playwright.async_api import async_playwright

from tt.config import logger, settings
# from playwright.async_api import async_playwright
from tt.config import settings
from tt.plugins.plugin_manager import BasePlugin
from tt.utils import send_notification

Expand Down Expand Up @@ -61,11 +60,12 @@ async def get_www_run(self):
"""
Gets the screenshot
"""
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.goto(settings.www_url)
logger.debug(await page.title())
scr = await page.screenshot()
await browser.close()
return scr
pass
# async with async_playwright() as p:
# browser = await p.chromium.launch()
# page = await browser.new_page()
# await page.goto(settings.www_url)
# logger.debug(await page.title())
# scr = await page.screenshot()
# await browser.close()
# return scr?image=Yes
2 changes: 1 addition & 1 deletion tt/talky_settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ping = "8.8.8.8"
### WWW SETTINGS ###
########################################

www_enabled = true
www_enabled = false
www_commands = "📷 /src\n"
bot_command_screenshot = "scr"
www_url = "https://apod.nasa.gov/apod/astropix.html"
Expand Down

0 comments on commit 7c8492d

Please sign in to comment.