@shlopa

Код на Python написан правильно но вот система постоянна выдаёт ошибку пробовал обновлять все билиотеки но ошибка остаётся?

Вот код:
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
  • Вопрос задан
  • 101 просмотр
Решения вопроса 1
Mike_Ro
@Mike_Ro Куратор тега Python
Python, JS, WordPress, SEO, Bots, Adversting

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

Похоже, что внутри __init__.py (aiogram\dispatcher) проблемы с табуляцией.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы