alwaysdungeons/generate.py

29 lines
777 B
Python
Raw Permalink Normal View History

2023-08-28 18:53:17 -05:00
from poe_api_wrapper import PoeApi
import os
2023-08-29 15:23:51 -05:00
from dotenv import load_dotenv
load_dotenv()
2023-08-28 21:00:35 -05:00
client = PoeApi(os.environ['POE_TOKEN'])
2023-08-28 18:53:17 -05:00
import asyncio
#from revChatGPT.V1 import AsyncChatbot
#chatbot = AsyncChatbot(config={
# "email": os.environ['email'],
# "password": os.environ['pass']
#})
#Auth
async def GetText(prompt,bot = "chinchilla"):
prev_text = ""
#code = ""
for chunk in client.send_message(bot, prompt, suggest_replies=True):
await asyncio.sleep(0.05)
prev_text = chunk["text"]
client.delete_chat(bot, del_all=True)
#client.chat_break(bot, chatCode = code)
#async for data in chatbot.ask(prompt):
# message = data["message"][len(prev_text) :]
# #print(message, end="", flush=True)
# prev_text = data["message"]
2023-08-28 19:54:45 -05:00
return prev_text