Вот код:
import openai
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
token = 'тут токен'
openai.api_key = 'токен'
bot = Bot(token)
dp = Dispatcher(bot)
@dp.message_handler()
async def send(message: types.Message):
response = openai.Completion.create(
model="text-davinci-03",
prompt=message.text,
temperature=0.9,
max_tokens=1000,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.6,
stop=["You:"]
)
await message.answer(response['choices'][0]['text'])
А вот ошибка :
C:\Peton\python\.venv\Scripts\python.exe C:\Peton\python\AItelega.py
Traceback (most recent call last):
File "C:\Peton\python\AItelega.py", line 2, in <module>
from aiogram import Bot, types
File "C:\Peton\python\.venv\lib\site-packages\aiogram\__init__.py", line 4, in <module>
from aiogram.dispatcher.flags import FlagGenerator
File "C:\Peton\python\.venv\lib\site-packages\aiogram\dispatcher\__init__.py", line 2
^
IndentationError: expected an indented block after class definition on line 1
Process finished with exit code 1