This commit is contained in:
parent
4bf29c87fd
commit
7623e25238
@ -9,9 +9,10 @@ load_dotenv()
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from ads import AsyncDataSet
|
from ads import AsyncDataSet
|
||||||
from devranta.api import Api
|
|
||||||
from grk import GrokAPIClient
|
from grk import GrokAPIClient
|
||||||
|
|
||||||
|
from devranta.api import Api
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
|
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
|
||||||
)
|
)
|
||||||
@ -78,6 +79,7 @@ class Bot:
|
|||||||
|
|
||||||
if rant["user_username"] == username:
|
if rant["user_username"] == username:
|
||||||
rant["type"] = "rant"
|
rant["type"] = "rant"
|
||||||
|
rant["rant_id"] = rant["id"]
|
||||||
results.append(rant)
|
results.append(rant)
|
||||||
logging.info("Found rant by %s: %s", username, rant)
|
logging.info("Found rant by %s: %s", username, rant)
|
||||||
|
|
||||||
@ -105,7 +107,9 @@ class Bot:
|
|||||||
for obj in objects:
|
for obj in objects:
|
||||||
print("Rant: \033[92m" + obj["text"] + "\033[0m")
|
print("Rant: \033[92m" + obj["text"] + "\033[0m")
|
||||||
diss = await self.llm.chat_async(obj["text"])
|
diss = await self.llm.chat_async(obj["text"])
|
||||||
|
diss = f"@{obj['user_username']} {diss}"
|
||||||
print("Response: \033[91m" + diss + "\033[0m")
|
print("Response: \033[91m" + diss + "\033[0m")
|
||||||
|
await self.api.post_comment(obj["rant_id"], diss)
|
||||||
await self.mark_responded(obj["text"], diss)
|
await self.mark_responded(obj["text"], diss)
|
||||||
|
|
||||||
async def run(self) -> None:
|
async def run(self) -> None:
|
||||||
@ -125,7 +129,6 @@ async def main() -> None:
|
|||||||
target = os.getenv("TARGET")
|
target = os.getenv("TARGET")
|
||||||
llm_key = os.getenv("LLM_KEY")
|
llm_key = os.getenv("LLM_KEY")
|
||||||
|
|
||||||
|
|
||||||
bot = Bot(username, password, target, llm_key)
|
bot = Bot(username, password, target, llm_key)
|
||||||
await bot.delete_responded()
|
await bot.delete_responded()
|
||||||
await bot.run()
|
await bot.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user