- 131
- 19
Хз че за фигня. Но у него явно интелект, как у меня. Че не так я сделал. chat gpt
code:
import openai
import aiogram
from aiogram import Bot, Dispatcher, types
from aiogram.utils import executor
openai.api_key = "chat gpt api"
bot = Bot(token="bot api")
dp = Dispatcher(bot)
@dp.message_handler()
async def send_gpt_response(message: types.Message):
text = message.text
response = openai.Completion.create(
engine="davinci",
prompt=text,
max_tokens=60,
n=1,
stop=None,
temperature=0.5
)
await bot.send_message(chat_id=message.chat.id, text=response.choices[0].text)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)