Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki authored Aug 5, 2023
2 parents d411f22 + 7c8492d commit 3c60656
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 33 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ Place order, inquire your balance and more through plugins.<br>
Easily deploy via Docker on self-hosted platform or Paas.<br>
<br>
<p align="left">
<a href="https://talkytrader.github.io/wiki/"><img src="https://img.shields.io/badge/Wiki-%23000000.svg?style=for-the-badge&logo=wikipedia&logoColor=white"></a><br>
<a href="https://talkytrader.github.io/wiki/"><img src="https://img.shields.io/badge/Wiki-%23000000.svg?style=for-the-badge&logo=wikipedia&logoColor=white"></a>
<a href="https://github.com/mraniki/tt/"><img src="https://img.shields.io/badge/github-%23000000.svg?style=for-the-badge&logo=github&logoColor=white"></a>
<a href="https://hub.docker.com/r/mraniki/tt"><img src="https://img.shields.io/docker/pulls/mraniki/tt?style=for-the-badge"></a><br>
<a href="https://coindrop.to/mraniki"><img src="https://img.shields.io/badge/tips-000000?style=for-the-badge&logo=buymeacoffee&logoColor=white"></a>
<a href="https://t.me/TTTalkyTraderChat/1"><img src="https://img.shields.io/badge/talky-blue?style=for-the-badge&logo=telegram&logoColor=white"></a>
<a href="https://discord.gg/gMNERs5M9"><img src="https://img.shields.io/discord/1049307055867035648?style=for-the-badge&logo=discord&logoColor=white&label=%20%20&color=blue"></a><br>
<!-- <a href="https://hub.docker.com/r/mraniki/tt"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/mraniki/tt?style=for-the-badge&logo=Docker&logoColor=white"></a><br> -->
<a href="https://coindrop.to/mraniki"><img src="https://img.shields.io/badge/tips-000000?style=for-the-badge&logo=buymeacoffee&logoColor=white"></a><br>
<a href="https://hub.docker.com/r/mraniki/tt"><img src="https://img.shields.io/docker/pulls/mraniki/tt?style=for-the-badge"></a>
<a href="https://t.me/TTTalkyTraderChat/1"><img src="https://img.shields.io/badge/talky-blue?style=for-the-badge&logo=telegram&logoColor=white"></a><br>
<br>

<img src="https://img.shields.io/github/v/release/mraniki/tt?style=for-the-badge"><br>
<a href="https://talkytrader.github.io/wiki/"><img src="https://img.shields.io/github/actions/workflow/status/mraniki/tt/%F0%9F%91%B7Flow.yml?style=for-the-badge&logo=GitHub&logoColor=white"></a><br>
Expand Down
1 change: 0 additions & 1 deletion tt/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ async def webhook(request: Request):
host=settings.host,
port=int(settings.port),
log_level="critical")

11 changes: 6 additions & 5 deletions tt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ def loguru_setup():
loguru_logger.remove()
# log.configure(**config)
log_filters = {
"discord": "INFO",
"telethon": "INFO",
"web3": "INFO",
"apprise": "INFO",
"urllib3": "INFO",
"discord": "ERROR",
"telethon": "ERROR",
# "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
6 changes: 3 additions & 3 deletions 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 All @@ -135,9 +135,9 @@ llm_provider = "g4f.Provider.Providers.ChatgptAi"
llm_host = ""
llm_auth_token = ""
llm_default_prompt = "write a tiny story"
llm_commands = "🦾 /qq\n"
llm_commands = "🦾 /qq\n /tq"
bot_command_question = "qq"

bot_command_topic = "tq"

########################################
### FINDMYORDER SETTINGS ###
Expand Down
10 changes: 10 additions & 0 deletions tt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
async def send_notification(msg):
"""
💬 Notification via Apprise
Args:
msg (str): Message
Returns:
None
Refer to Apprise documentation for more information
"""
aobj = Apprise(settings.apprise_url)
msg_format = settings.apprise_format or NotifyFormat.MARKDOWN
Expand All @@ -27,6 +36,7 @@ async def send_notification(msg):
async def run_bot():
"""
🤖 Run the chat bot & the plugins.
"""
listener = Listener()
plugin_manager = PluginManager()
Expand Down

0 comments on commit 3c60656

Please sign in to comment.