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