27 lines
775 B
Python
27 lines
775 B
Python
import openai
|
||
from aiogram import types, Dispatcher
|
||
from create_bot import dp, bot
|
||
|
||
token = '5947963644:AAF_GKgMmU5ovqMpc1KXIpcf4aN0JMyKPqc'
|
||
openai.api_key = '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'
|
||
|
||
@dp.message_handler()
|
||
async def send(message: types.Message):
|
||
if 'тупица' in message.text.lower():
|
||
|
||
## TODO уточнить остатки токенов и денег
|
||
response = openai.Completion.create(
|
||
model="text-davinci-003",
|
||
prompt=message.text[7:],
|
||
temperature=0.7,
|
||
max_tokens=1000,
|
||
top_p=1.0,
|
||
frequency_penalty=0.0,
|
||
presence_penalty=0.6,
|
||
stop=["сброс"]
|
||
)
|
||
await message.reply(response['choices'][0]['text'])
|
||
|
||
|
||
|